Critical Ocean Hunter issue

Having technical difficulties with Supermodel? Last-minute wardrobe malfunction? Get help here.
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: Critical Ocean Hunter issue

Postby HarryTuttle » Thu Apr 13, 2017 3:32 pm

Ian, going back to model shading issue, look at this (happens when I don't normalize gl_NormalMatrix*gl_Normal):
oh03.jpeg
oh03.jpeg (224.71 KiB) Viewed 5080 times

the man on the right is greatly overbrighten compared to surrounding objects, in fact they are rendered fine. I've just dumped some values of polygon and vertex normals as calculated in <New3D.cpp>, and they're in the -1,1 interval.

The viewport has the same sun values, only those polygon shading change. I'm thinking about some "gl_NormalMatrix" issue (on vertex shader side), sadly I don't know where to look in <New3D.cpp> for those value. But if this has something to do with bad model matrix you cited it could make sense.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Critical Ocean Hunter issue

Postby Ian » Thu Apr 13, 2017 4:05 pm

If the ambient values are quite high, and you don't clamp the final result, it can easily look like that ..
In Bart's original shaders he didn't clamp the lighting values and everything looked quite oversaturated.

Even if the model normals are still -1 + 1 range they can still have a unit length of more than one
Try V3::length(const Vec3 v)
and see if any are greater than 1
Ian
 
Posts: 1547
Joined: Tue Feb 23, 2016 9:23 am

Re: Critical Ocean Hunter issue

Postby Ian » Thu Apr 13, 2017 4:08 pm

The normal matrix is something like the transpose of the top 3x3 of the model matrix. The bad matrices would also effect the position of the models but there are no bad matrices in that scene. If they were bad the model would end up in completely the wrong place.
Ian
 
Posts: 1547
Joined: Tue Feb 23, 2016 9:23 am

Re: Critical Ocean Hunter issue

Postby HarryTuttle » Thu Apr 13, 2017 4:31 pm

Ian wrote:If the ambient values are quite high, and you don't clamp the final result, it can easily look like that ..
In Bart's original shaders he didn't clamp the lighting values and everything looked quite oversaturated.


In that scene the ambient is 0.4, even if I clamp the final result of illuminated fragment the wrong shade is still there, also many scenes from other games will be too dull and dimmed, checked with real footage. The only exception are step 1.0 games, in that case you've to clamp. That's why in my build I exported the model stepping as uniform to fragment shader and made the appropriate clamping decision there.

Here's the arcade version (compare the man's almost absent shading with the shark shading):
oh04.jpeg
oh04.jpeg (164.14 KiB) Viewed 5072 times


Check for example the attract mode in Harley and compare with Abe's videos.

Ian wrote:Even if the model normals are still -1 + 1 range they can still have a unit length of more than one
Try V3::length(const Vec3 v)
and see if any are greater than 1

Ok, I'll try that :)
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Critical Ocean Hunter issue

Postby HarryTuttle » Thu Apr 13, 2017 4:40 pm

That scene with normalized gl_NormalMatrix*gl_Normal and clamped sun ambient+intensity:
oh05.jpeg
oh05.jpeg (245.15 KiB) Viewed 5071 times


the same scene without normalized gl_NormalMatrix*gl_Normal but with clamped sun ambient+intensity:
oh06.jpeg
oh06.jpeg (247.31 KiB) Viewed 5071 times

Seems a toon btw :)
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Critical Ocean Hunter issue

Postby Ian » Thu Apr 13, 2017 4:46 pm

I had a quick look too

Image

Maybe the fog is attenuating the diffuse component of the lighting?
Ian
 
Posts: 1547
Joined: Tue Feb 23, 2016 9:23 am

Re: Critical Ocean Hunter issue

Postby HarryTuttle » Thu Apr 13, 2017 4:55 pm

Ian wrote:Maybe the fog is attenuating the diffuse component of the lighting?


I don't think so, the fog already alters the fragment (texture * poly * lightning), I don't think there's like a second pass to the diffuse component alone.

Ian wrote:Even if the model normals are still -1 + 1 range they can still have a unit length of more than one

Sorry, wrong assumption of mine ;) The length could be at maximum a value of 3.0 if I understood correctly. In those scenes the value of length(gl_NormalMatrix*gl_Normal) in vertex shader is over 3.0 for some of those models.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

Re: Critical Ocean Hunter issue

Postby Ian » Thu Apr 13, 2017 4:59 pm

One possibility
If the models are scaled with the model matrix
That will effect the normals, it will also scale them.
I am not sure how to check for a scaled model matrix
Ian
 
Posts: 1547
Joined: Tue Feb 23, 2016 9:23 am

Re: Critical Ocean Hunter issue

Postby Ian » Thu Apr 13, 2017 5:12 pm

One more possibility... some material value or something in the polygon headers effects the lighting for these models.
The sharks looks like they are lit correctly by the sun
Ian
 
Posts: 1547
Joined: Tue Feb 23, 2016 9:23 am

Re: Critical Ocean Hunter issue

Postby HarryTuttle » Thu Apr 13, 2017 5:31 pm

Ian wrote:The sharks looks like they are lit correctly by the sun


That's in fact what puzzled me.
User avatar
HarryTuttle
 
Posts: 646
Joined: Thu Mar 09, 2017 8:57 am

PreviousNext

Return to The Fitting Room

Who is online

Users browsing this forum: No registered users and 3 guests