[Patch] Specular Highlight

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!

Re: [Patch] Specular Highlight

Postby Ian » Wed Mar 29, 2017 4:43 pm

maybe its something like this ..
Image
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Specular Highlight

Postby Bart » Thu Mar 30, 2017 9:29 am

I'm not up to speed on what you have or haven't tried but could the winding parameter influence how the quads are defined? Has this been tested?
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: [Patch] Specular Highlight

Postby Ian » Thu Mar 30, 2017 9:44 am

The real3d doesn't use the winding at all
I think what's happening is the order of the vertices for the quads is wrong. With triangles it makes no difference either way. With quads, assuming they are planar .. also makes no difference. But when they are not planar, or do other crazy stuff things can fall apart.

What I *think* might be happening is this ..
Say a quad is sent for rendering. So we have 4 vertices
v[1] v[2] v[3] v[4]
The next quad shares vertices 2 and 3 from the last buffer.
So we get
v[ ] v[ ] v[3] v[4]
Then we add the next 2 vertices so we again get
v[1] v[2] v[3] v[4]


But what we are doing is this
Quad 1
v[1] v[2] v[3] v[4]
Next quad shares 2 vertices, but we move them to the start so
v[3] v[4] v[ ] v[ ]
Then the next 2 vertices get added at the end
v[3] v[4] v[1] v[2]

The tl:dr version.
We move the shared vertices into the beginning slots. I am guessing the hardware doesn't bother unnecessarily copying them. This can lead to the diagonal split changing between each squared quad.

I am not 100% sure this is what is happening. Gonna give it a go when I have some time.
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Specular Highlight

Postby Ian » Sun Jun 25, 2017 1:26 pm

Image

We need to add this :)

From a few minutes of debugging this evening .. I'd say that sun angle or the specular flips if the Z value of the sun becomes positive.
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Specular Highlight

Postby HarryTuttle » Mon Jun 26, 2017 12:24 am

Ian wrote:From a few minutes of debugging this evening .. I'd say that sun angle or the specular flips if the Z value of the sun becomes positive.


Do you think it could fix lightning in L.A. Machineguns?
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Specular Highlight

Postby Ian » Mon Jun 26, 2017 12:47 am

Hopefully:) Just need to make some test cases. It didn't help before the coordinates were all messed up because we were doing part of the coordinate conversion in the shader, and part of it outside the shader. Which made debugging almost impossible.

My plan is to draw some big fat arrows indicating the sun direction then see where the specular highlights show up in real footage and compare. Some good specular footage here -> https://youtu.be/UL_SvP3WDv4?t=3m10s

I did find this error in the lighting of La Machine guns .. maybe deserves it's own thread.

Image

Ambient is set to 1, so there is no shading at all here. But on the real hardware, even though the footage is poor quality you can clearly see shading. Wonder if the ambient and diffuse values for lighting are divided by the model scale, instead of normalisation ....

Say if the model matrix scaled the model 2.0 times. Instead of normalising every vertex, you could instead just divide sun ambient & diffuse by 2? Have to try that at some point
Last edited by Ian on Mon Jun 26, 2017 1:07 am, edited 1 time in total.
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Specular Highlight

Postby HarryTuttle » Mon Jun 26, 2017 1:05 am

Beware that most of the lightning in that game is fixed shaded, sometime in combination with TranslatorMap bit set. In my build, for example, the lightning in that scene is more similar to the arcade version.

(Cannot post any screenshot right now 'cause I'm out of town again until 5/6 july).
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: [Patch] Specular Highlight

Postby Ian » Mon Jun 26, 2017 1:20 am

I set the fixed shaded value to 0
So you can see what's lit normally (in this case the people)

Image

Shading is totally absent in supermodel
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: [Patch] Specular Highlight

Postby Bart » Mon Jun 26, 2017 7:56 pm

I've noticed that as well. Are either specular shading or the translator mapped used on the NPCs?
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: [Patch] Specular Highlight

Postby Bart » Mon Jun 26, 2017 7:58 pm

Ian wrote:Say if the model matrix scaled the model 2.0 times. Instead of normalising every vertex, you could instead just divide sun ambient & diffuse by 2? Have to try that at some point


That's an interesting idea...have you had a chance to try?
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

PreviousNext

Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest

cron