[No, but PRs welcome] Normal and Specular for Sprites

Moderator: GZDoom Developers

Normal and Specular for Sprites

Postby furyweb » Fri Dec 28, 2018 7:31 pm

I know we have PBR for textures, but how about normal and specular for sprites? Or is it something that will never happen?.
User avatar
furyweb
 
Joined: 30 Aug 2018
Location: UK

Re: Normal and Specular for Sprites

Postby Graf Zahl » Sat Dec 29, 2018 2:29 am

How would you define a normal for something that is just supposed to be a 2D projection of a 3D object that looks fake no matter what you do? For this reason there is no per-pixel lighting on sprites to begin with.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Normal and Specular for Sprites

Postby Nash » Sat Dec 29, 2018 2:44 am

Due to the nature of billboarding techniques (the quad constantly rotating to face the camera), per pixel lighting on sprites would look bad in motion anyway as the lighting on the sprite will constantly change depending on how you look at it.

For example, in a very dark room, a light source standing behind a monster would not light the monster (producing a dark silhouette of the sprite), but if you move around the opposite side so that the light source is now in front of the monster (relative to your current position), suddenly the monster will be brightly lit. It looks terrible. :D
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Normal and Specular for Sprites

Postby Polly Bardhood » Sun Jan 27, 2019 3:38 pm

I don't know if it's possible to apply a parallax mapping shader that now works with textures, could give some 3d effect to them but if it's too much load on the engine then it's a bad idea?
Polly Bardhood
 

Re: Normal and Specular for Sprites

Postby Charlotte Crellystin » Wed Apr 03, 2019 5:52 pm

I would urge you guys to check out prodeus. It has dynamically lit sprites with normals and died and it looks amazing in motion.

https://steamcdn-a.akamaihd.net/steam/a ... 1542894486
Charlotte Crellystin
 

Re: Normal and Specular for Sprites

Postby Indecom » Wed Apr 03, 2019 6:34 pm

@graf: For this effect to work the normal would just be normalize(camera.xy - object.xy). Forgo the z axis since things only rotate around the z axis, reducing the amount of work you'd need to do and keeping the effect from breaking when the player for instance increases in height compared to the sprite in question. This also wouldn't need to be an always on effect, in the shader you could switch between the old method and the new based on whether or not the right kind of material is defined.

I know that this is a fairly old topic but one of the things that bothers me about the subject is when someone says we shouldn't enable this feature because we don't think you can make something look good with it. On that note I'd like to share this image from the game Prodeus, which features 2d enemy sprites with full PBR materials in a 3d environment:

https://twitter.com/i/status/1111685313372524545

Being a difficult feature to add is a far better reason than to just say we don't trust you to make this look good so we shouldn't allow it in the first place. The effect works, and it works really well when you know how to use it, and as a general rule people who can create pbr materials are the kind of people who would know how to.

I would personally like to see this feature added. I've been able to fake it for first person weaponry by just creating a simple plane model as an md3 and adding the requisite textures to it and it looks amazing:

https://gyazo.com/ddf8064518ed0778c880fe69c06da3cd

Again, I'm sorry for resurrecting an old post, but I think that this feature would help thrust this engine into the future and help contribute to the curation of some amazing content.

Also I'm sorry if I sound like I'm blowing hot air, I don't know what goes into programming the graphics of GZD, but I am a shader programmer and game developer so I do know some things, like the merit of adding new features just for the hell of it. Lol
User avatar
Indecom
Check out QuakenDoom 2, my Q2 TC for Doom 2
 
Joined: 13 Jul 2009

Re: Normal and Specular for Sprites

Postby Matt » Wed Apr 03, 2019 8:53 pm

The KS mentions something about "dynamic sprite sheets" and the angle changes as the player approaches the target in the video on that tweet look completely seamless. (and further down the ProDeus devs mention you'll be able to customize this to make it look choppier with fewer angles.) Is what they're doing even comparable to the way sprites are handled in Doom?
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Normal and Specular for Sprites

Postby Indecom » Wed Apr 03, 2019 9:05 pm

Yes, they are rendering their character models to a series of textures, normal, spec, and diffuse versions. This is then applied to a billboard plane which then has lighting information calculated based on the realtime pre-rendered inputs.

Essentially they are pre-rendering 3d models to a sprite, only they are doing it in realtime. But only for character models. Props you find in the environment are all pre-rendered to texture atlases/sprite sheets in a more traditional sense.

Like this guy:
https://twitter.com/i/status/984078088245075968

They also rendered the models as viewed from different heights as well, but still it's the same principle, and it works.
User avatar
Indecom
Check out QuakenDoom 2, my Q2 TC for Doom 2
 
Joined: 13 Jul 2009

Re: Normal and Specular for Sprites

Postby Nash » Thu Apr 04, 2019 11:59 am



This is how per pixel lighting would end up looking on sprites, in case anyone is curious.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Normal and Specular for Sprites

Postby Indecom » Thu Apr 04, 2019 2:20 pm

When you apply the effect to a sorry bare without any specialized materials it's not going to look good. The whole point of this topic is for normals and spec, not just per pixel lighting. It has to be set up right, and anyone who's capable of generating the maps required will be capable of setting it up right.
User avatar
Indecom
Check out QuakenDoom 2, my Q2 TC for Doom 2
 
Joined: 13 Jul 2009

Re: Normal and Specular for Sprites

Postby Matt » Thu Apr 04, 2019 5:01 pm

With the amount of work that would take, it feels like any original content would be better served with models...
User avatar
Matt
Putting the XD into *xdeath since 2007
 
 
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Normal and Specular for Sprites

Postby furyweb » Thu Apr 04, 2019 5:17 pm

At the moment nash is right in his video. I tried it with a simple flat plain just to test and although it looks great when approaching a light from the front, from the back it looks crap.

And as you can see in this video I did a test with flat 3d plane with sprites for the weapon, and although it looks great when you approach a light it doesnt work, the light has to be behind you or to the side.

https://www.youtube.com/watch?v=lYuIlwZ5jrA
User avatar
furyweb
 
Joined: 30 Aug 2018
Location: UK

Re: Normal and Specular for Sprites

Postby dpJudas » Thu Apr 04, 2019 5:17 pm

I honestly don't understand of the point of pre-rendered 3d sprites. If it was the mid-90's where you might not have the GPU power to render the model directly it makes sense, but as far as I'm concerned a real model looks better.

In any case, the shader logic is already there to do this (materials, normal vector and light sources). All it requires is a slightly different RenderState setup in the sprite code (use light source instead of single dynlight color). I don't have any personal interest in this however. Someone else would have to make a PR and get it approved by Graf.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Normal and Specular for Sprites

Postby Indecom » Thu Apr 04, 2019 11:04 pm

I'd like to thank everyone for their contributions to the topic.

@dpJudas I'll gladly take a look at the code myself and see if I can make heads or tails of it. The main school of thought behind wanting this effect is to accomplish a certain aesthetic which isn't possible right now with the way sprites are set up. With the right artist taking advantage of the effect, great things can be accomplished.

@furryweb, I'd love to take a look at your material setups because I've had great results with this personally.
https://youtu.be/05Ri235Ymyw
User avatar
Indecom
Check out QuakenDoom 2, my Q2 TC for Doom 2
 
Joined: 13 Jul 2009


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 3 guests