Smoothed lighting for select walls and vert slopes

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

Moderator: Developers

Smoothed lighting for select walls and vert slopes

Postby Indecom » Wed Jul 11, 2018 5:44 pm

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 7:24 pm, edited 1 time in total.
User avatar
Indecom
Check out QuakenDoom 2, my Q2 TC for Doom 2
 
Joined: 13 Jul 2009

Re: Smoothed lighting for round walls and vert slopes

Postby dpJudas » Wed Jul 11, 2018 7:09 pm

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.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Smoothed lighting for round walls and vert slopes

Postby Indecom » Wed Jul 11, 2018 7:14 pm

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
Indecom
Check out QuakenDoom 2, my Q2 TC for Doom 2
 
Joined: 13 Jul 2009

Re: Smoothed lighting for round walls and vert slopes

Postby Graf Zahl » Thu Jul 12, 2018 1:17 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 2 guests