Page 1 of 3

Light clamping

PostPosted: Sat Jul 29, 2017 8:40 am
by Ian
Some games the clamped light model
ie
Code: Select all
lightIntensity = clamp(lightIntensity,0.0,1.0);

Is definitely correct

Others it looks wrong

Here is one example. Ocean hunter

Original
Image

Clamped (incorrect)
Image

Unclamped (correct)
Image

i wonder .. if there are some config options similar to what LA machine guns uses (that we have yet to find) to setup some of these lighting options ...

Re: Light clamping

PostPosted: Sat Jul 29, 2017 8:48 am
by HarryTuttle
I would say that definitely step 1.0 is always clamped and 1.5 unclamped (as in Scud).

For step 2.x I always observed that the unclamped version seems right. I'll check some specific case, if I find something relevant I'll post some screenshot.

UPDATE:
Oops, I just forgot that I've posted Daytona2 screens where the overall scene is unclamped, especially the road brightness.

Re: Light clamping

PostPosted: Sat Jul 29, 2017 9:14 am
by Ian
Post them here :) Maybe we can figure this thing out

My best guess is lost world uses the clamped light model.
If you look at the foot there is no attenuation to the light. It's either 100% or 0%.

Image

Re: Light clamping

PostPosted: Sat Jul 29, 2017 9:39 am
by HarryTuttle
hmm, that video... I suppose is from Abe, I always wondered why those Lost World direct capture videos were so overbrightened in respect of his other ones. Maybe a bad gamma setting, anyway here's Supermodel version:
lostw_01a.png
lostw_01a.png (142.56 KiB) Viewed 4608 times

...and to simulate the overbright video:

(the same but with Gamma 1.8, Black Output level rised to 40 and Saturation 130%)
lostw_01b.png
lostw_01b.png (172.67 KiB) Viewed 4608 times

I think we have the same light distribution save for the water ripples that, I think, are specular so not definitive yet. Besides: have you noted Model3 hides the upper part of t-rex leg? Maybe it's some discard information at node level.

Re: Light clamping

PostPosted: Sat Jul 29, 2017 10:19 am
by Ian
You are right, it's really hard to compare without good quality captures
With limited time, this is the only other video I could find, quality still not great

Image

Re: Light clamping

PostPosted: Sat Jul 29, 2017 12:49 pm
by HarryTuttle
Ian, I've just merged your last commit in my build and works great! I didn't think of a model-level attribute (model->scale), it just makes sense after all :)

In my version also something wasn't updated correctly because my "modelScale" values weren't always set or were wrong, hence my hybrid solution to rely only on the matrix scaling factor and use "modelScale" just as a trigger.

However by scaling the "matrix*normal" product still produces errors with specular lightning (not visible in the official build). We should first divide the normal vector by its length (or normalize it), then scaling it, and finally multiply it with the matrix.

Also relying on the matrix scale values when "modelScale" is 1.0 (or unset) fixes Lost World overbrightened models. Again, in the official build we cannot see this misbehavior because the sunlight in the shader is always clamped.

Here's my proposed change in <R3DShader.cpp>:

Re: Light clamping

PostPosted: Sun Jul 30, 2017 5:07 am
by Ian
However by scaling the "matrix*normal" product still produces errors with specular lightning (not visible in the official build). We should first divide the normal vector by its length (or normalize it), then scaling it, and finally multiply it with the matrix.


What kind of errors do you see? Screenshots would help :)

Also I had a look into that bug of why the leg shows up in supermodel.. but not on the real hardware. But I have no real answer. Unlike the virtua fighter bug where polys showed up where they shouldn't, this seems to be opposite. You would expect the leg to render, but for whatever reason it doesn't. The culling nodes themselves all look almost identical. Maybe a bug on the real h/w.

Re: Light clamping

PostPosted: Sun Jul 30, 2017 7:54 am
by HarryTuttle
Ian wrote:The culling nodes themselves all look almost identical. Maybe a bug on the real h/w.


There're two node-level discard bits in culling node, however I haven't had time to look into them since I'm still debugging specular highlight before submitting an updated patch.

Speaking of crazy geometry: there's also this in Daytona 2 BOTE:
d2_bote_01.jpeg
d2_bote_01.jpeg (219.06 KiB) Viewed 4498 times

when I looked at it with Superdebugger it seems to be some sort of polygon with a pilot suit texture. It just pops out from the top for a brief period in the intro.

Re: Light clamping

PostPosted: Sun Jul 30, 2017 7:58 am
by HarryTuttle
Ian wrote:What kind of errors do you see? Screenshots would help :)


dimmed specular in ECA:
eca_01.png
eca_01.png (241.72 KiB) Viewed 4499 times

Re: Light clamping

PostPosted: Sun Jul 30, 2017 8:29 am
by Ian
HarryTuttle wrote:
Ian wrote:The culling nodes themselves all look almost identical. Maybe a bug on the real h/w.


There're two node-level discard bits in culling node, however I haven't had time to look into them since I'm still debugging specular highlight before submitting an updated patch.

Speaking of crazy geometry: there's also this in Daytona 2 BOTE:
d2_bote_01.jpeg

when I looked at it with Superdebugger it seems to be some sort of polygon with a pilot suit texture. It just pops out from the top for a brief period in the intro.


Does that crazy poly happen in attract mode? If you can upload a save state, must go out now :) Will look at it later