3D model lighting via headlamp effect?

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

Moderator: GZDoom Developers

3D model lighting via headlamp effect?

Postby Diode » Sun Jun 24, 2018 9:10 am

We all know that 3D models in typical doom environments without dynamic lights in them look ugly and flat due to being uniformly lit, so... why not light them with a headlamp that only illuminates models? Why not have their ambient light level be perhaps be slightly lower than the sector light level, and then apply the sector light level as a highlight shining from the camera (or even slightly above the camera)?

This would essentially be mimicking the way most sprites are shaded.

To get an idea of what this would looks like when strafing around a model, just open blender and rotate the camera around an unlit model. Blender applies the same headlamp effect.
Diode
 
Joined: 29 Feb 2016

Re: 3D model lighting via headlamp effect?

Postby Cherno » Sun Jun 24, 2018 9:23 am

What I would like to see instead is a global directional light, like sunlight, that shines from above at an angle, with a possible second, weaker directional light shining in the inverted direction (to light the areas of a model that the main light doesn't reach).
User avatar
Cherno
 
Joined: 06 Dec 2016

Re: 3D model lighting via headlamp effect?

Postby Diode » Sun Jun 24, 2018 11:52 am

Cherno wrote:What I would like to see instead is a global directional light, like sunlight, that shines from above at an angle, with a possible second, weaker directional light shining in the inverted direction (to light the areas of a model that the main light doesn't reach).


That would be nice for maps designed specifically for 3D models from the ground up, but that's a vanishingly small percentage of content. If you want models to look good across the board, you've got to work within the bounds of sector lighting.

Hence my call to apply the sector lighting as if it were shining from the camera.
Diode
 
Joined: 29 Feb 2016

Re: 3D model lighting via headlamp effect?

Postby RockstarRaccoon » Wed Jun 27, 2018 10:43 am

Keeping in mind I haven't really experimented with this yet, but doesn't attenuated lighting light them properly? I feel like it would be better to just get the normal lighting effects to work on them than to put in this Legacy work around...
User avatar
RockstarRaccoon
Totally Babies
 
Joined: 31 Jul 2016

Re: 3D model lighting via headlamp effect?

Postby Diode » Wed Jun 27, 2018 1:19 pm

RockstarRaccoon wrote:doesn't attenuated lighting light them properly? I feel like it would be better to just get the normal lighting effects to work on them than to put in this Legacy work around...


They do, but they do nothing to address the problem of sector lighting. Until you've got something applying sector light from an angle, sector lights are always going to result in flat looking models - which means models look flat on 99.9% of maps.

I know that shaders can be applied to models in GLDEFS, so if it's possible possible to tweak colors based on view angle, this is potentially a shader request rather than a feature request.
Diode
 
Joined: 29 Feb 2016

Re: 3D model lighting via headlamp effect?

Postby RockstarRaccoon » Wed Jun 27, 2018 11:24 pm

Could put an attenuated spotlight on the player's viewpoint that has relatively high intensity but #202020 as a color, and it would function like you're saying, I think...
User avatar
RockstarRaccoon
Totally Babies
 
Joined: 31 Jul 2016

Re: 3D model lighting via headlamp effect?

Postby Diode » Thu Jun 28, 2018 9:41 am

RockstarRaccoon wrote:Could put an attenuated spotlight on the player's viewpoint that has relatively high intensity but #202020 as a color, and it would function like you're saying, I think...


That would illuminate level geometry as well, and wouldn't match sector light.

The Hardware shaders (https://zdoom.org/wiki/GLDEFS#Hardware_shaders) section of the GLDEFS article says that lightlevel and camerpos are variables that can be used, so I'm inclined to think that this or something close to it can be done through shaders. ...Although the fact that nobody's done it yet also suggests that it can't be done with the current tools.

Hopefully someone who knows will weigh in on this.
Diode
 
Joined: 29 Feb 2016

Re: 3D model lighting via headlamp effect?

Postby Diode » Sun Jul 01, 2018 7:11 am

So, using my grotesquely limited coding abilities, I attempted to cobble a crude and not-quite-right matcap shader and and apply it to the model's brightmap to fake the effect I was asking for. It would mean no brightmaps, but it was worth a shot.

...Unfortunately it seems a shader can't be applied to a brightmap. Fuck.

Still, I'm sure there's a way to do this, and I'm sure someone who actually had a clue what they were doing would bust this out in no time.

All I was able to do was put my useless wonky matcap on a model. It's... misaligned, but it's there.

https://i.imgur.com/6wk85Vp.png
Diode
 
Joined: 29 Feb 2016

Re: 3D model lighting via headlamp effect?

Postby Diode » Thu Jul 12, 2018 11:40 am



I've done some more blind fumbling with shaders and this is the current result. On the left is a the default rendering of a model with no dynamic lights near it, on the right is the same spot with a shader applied. If I had a clue what I was doing, shader would be applying that shadow to the parts of the model that are closest to facing 90 degrees from the camera, but because I don't, the calculations are wrong. Still, the model no longer looks flat and dynamic shadows are imitated even if they're not in the desirable positions.

This isn't necessarily a feature suggestion at this point - so I'll probably post about this elsewhere.
Diode
 
Joined: 29 Feb 2016


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest