Normal and Specular for Sprites

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Normal and Specular for Sprites

Re: Normal and Specular for Sprites

by Logan MTM » Fri Jun 12, 2020 3:56 pm

Hi everyone.
I am sorry to revive this topic.
Graf Zahl wrote: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.
What about decals sprites, wallsprites, ceiling sprites, flat sprites and stuff?
I am sure, just decals and wallsprites with material are
able to produces nice effects for who like to use imagination.

So please, make it possible.
All the best Doom people :thumb:

Re: Normal and Specular for Sprites

by Indecom » Thu Apr 04, 2019 10: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

Re: Normal and Specular for Sprites

by dpJudas » Thu Apr 04, 2019 4: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.

Re: Normal and Specular for Sprites

by furyweb » Thu Apr 04, 2019 4: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

Re: Normal and Specular for Sprites

by Matt » Thu Apr 04, 2019 4:01 pm

With the amount of work that would take, it feels like any original content would be better served with models...

Re: Normal and Specular for Sprites

by Indecom » Thu Apr 04, 2019 1: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.

Re: Normal and Specular for Sprites

by Nash » Thu Apr 04, 2019 10:59 am



This is how per pixel lighting would end up looking on sprites, in case anyone is curious.

Re: Normal and Specular for Sprites

by Indecom » Wed Apr 03, 2019 8: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.

Re: Normal and Specular for Sprites

by Matt » Wed Apr 03, 2019 7: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?

Re: Normal and Specular for Sprites

by Indecom » Wed Apr 03, 2019 5: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

Re: Normal and Specular for Sprites

by Guest » Wed Apr 03, 2019 4: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

Re: Normal and Specular for Sprites

by Guest » Sun Jan 27, 2019 2: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?

Re: Normal and Specular for Sprites

by Nash » Sat Dec 29, 2018 1: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

Re: Normal and Specular for Sprites

by Graf Zahl » Sat Dec 29, 2018 1: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.

Normal and Specular for Sprites

by furyweb » Fri Dec 28, 2018 6: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?.

Top