Smoothed lighting for select walls and vert slopes

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Smoothed lighting for select walls and vert slopes

Post by Indecom »

Now that GZD has a new materials system, I think we should implement an automatic normals generation routine that gives us smooth shading on wall segments marked with smooth lighting, as well as for vertex sloped ceiling or floor segments. I'm not sure the mount of work this would take, but it would drastically improve the usage of the new materials system. This would result in each vertex of the tagged sections getting their own normals vs the whole face sharing the same normal.

For those unsure of what I'm talking about, here's a visual representation with my target goal being the left image and the current state of things being the right.
Last edited by Indecom on Wed Jul 11, 2018 6:24 pm, edited 1 time in total.
dpJudas
 
 
Posts: 3037
Joined: Sat May 28, 2016 1:01 pm

Re: Smoothed lighting for round walls and vert slopes

Post by dpJudas »

I assume you mean using a smoothed normal for each vertex rather than the face normal. There are two problems with adding this:

1) You may not always want this. Mesh editors like 3ds Max and Blender have smoothing groups that faces can belong to so that you can better control when smoothing happens. In other words: this isn't a global on/off toggle but something which requires map editor support.

2) The ssao pass needs face normals, not smoothed normals. A smoothed normal causes self-shadowing. You can sometimes spot this on some md3 models today, but here it isn't that obvious because faces tend be relatively small there. If you start making large walls use smoothed normals it would be noticed very quickly. It is another step that requires additional work to support a feature like this.

By the way, your own image nicely illustrates #1: the smoothing didn't include the top face of the cylinder.
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Smoothed lighting for round walls and vert slopes

Post by Indecom »

Yes, this is why I mentioned only to do it for the walls that are tagged smoothlighting (SL from here on) , and only to the ceilings/floors that are vertex slopes. This way a person could design their levels to have hard edged walls next to smooth shaded walls, and so on.

Also, wall vertexes should only smooth with adjacent walls who share the SL tag, not with ceilings or floors. Any vertex of a SL tagged wall that's adjacent a non-SL tagged wall should be calculated as perpendicular to the linedef like the usual face norm would be. This could be used to create a round room that still has flat shaded recesses for doors and so on.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Smoothed lighting for round walls and vert slopes

Post by Graf Zahl »

dpJudas wrote: 1) You may not always want this. Mesh editors like 3ds Max and Blender have smoothing groups that faces can belong to so that you can better control when smoothing happens. In other words: this isn't a global on/off toggle but something which requires map editor support.
That would be the least of all problems. Just add a new field to the linedef or sidedef definition in UDMF specifying that the normals are to be interpolated.
2) The ssao pass needs face normals, not smoothed normals. A smoothed normal causes self-shadowing. You can sometimes spot this on some md3 models today, but here it isn't that obvious because faces tend be relatively small there. If you start making large walls use smoothed normals it would be noticed very quickly. It is another step that requires additional work to support a feature like this.
That's indeed a problem. It could be solved by passing two normals to the shader but at some point the vertex buffer would become too large so that it negatively affects performance if there's too many elements per vertex.
By the way, your own image nicely illustrates #1: the smoothing didn't include the top face of the cylinder.
Indeed. This is something that simply cannot be done as some simply automatic step.


But all of this doesn't address the main issue here: This would only affect dynamic lights. All the sector based light is flat per linedef and since it's identical at both vertices there's nothing to interpolate. Another thing to be considered here is fake contrast which currently gets calculated on the CPU side. This also would have to be moved to the GPU - otherwise the feature would require to disable fake contrast entirely.

So all things considered: I doubt that this is going to work out in the confines of a Doom based engine.
Post Reply

Return to “Feature Suggestions [GZDoom]”