Light clamping

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Light clamping

Postby Ian » Sat Jul 29, 2017 8:40 am

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 ...
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Light clamping

Postby HarryTuttle » Sat Jul 29, 2017 8:48 am

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.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Light clamping

Postby Ian » Sat Jul 29, 2017 9:14 am

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
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Light clamping

Postby HarryTuttle » Sat Jul 29, 2017 9:39 am

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 4607 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 4607 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.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Light clamping

Postby Ian » Sat Jul 29, 2017 10:19 am

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
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Light clamping

Postby HarryTuttle » Sat Jul 29, 2017 12:49 pm

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>:
Attachments
diff.zip
(1.82 KiB) Downloaded 212 times
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Light clamping

Postby Ian » Sun Jul 30, 2017 5:07 am

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.
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: Light clamping

Postby HarryTuttle » Sun Jul 30, 2017 7:54 am

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 4497 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.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Light clamping

Postby HarryTuttle » Sun Jul 30, 2017 7:58 am

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 4498 times
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Light clamping

Postby Ian » Sun Jul 30, 2017 8:29 am

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
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Next

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest