Jump to content

Help for deferred shading noob: Specularity


Rastar
 Share

Recommended Posts

I am used to a calculation of specular reflection along the lines of

 

pow( saturate( NdotH ), specularHardness )

 

maybe multiplied by an additional factor. Yet, when I look into the provided shaders, I see nothing of the sort, just a multiplication of specular texture times specular color, and then some sort of packing this into frag1.a

 

Where is my usual specular reflection? huh.png

Link to comment
Share on other sites

For specular using normals just color:

 

fragData1.a = materialcolorspecular;

 

for using specularmap : (standard luminance used by the television industry, rgb=0.299,0.587,0.114) (says google)

 

 

color_specular = texture(texture2,ex_texcoords0) * materialcolorspecular;
..
fragData1.a = color_specular.r * 0.299 + color_specular.g * 0.587 + color_specular.b * 0.114;

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

I was hoping you would jump in... smile.png Oh, OK, so this means I can only control the relative contributions of the three color channels to a materials specularity, but cannot really control e.g. the size of the specular dot (meaning: if the material is shiny or matte)?

Link to comment
Share on other sites

Yes you can, look in the pointlight.shader

 

specular = lightspecular * specularity * pow(clamp(-dot(lightreflection,screennormal),0.0,1.0),GLOSS);

 

GLOSS would control this. It's default 10.0, you could simply just send that through an uniform if you change the lighting shaders.

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

Although we don't have room for a per-material gloss value, one thing I have considered it packing a few extra flags into the material flags value. We could have two flags that would control four possible gloss values; low, medium, high, very high, or something like that.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...