Jump to content

..specular level control..


Naughty Alien
 Share

Recommended Posts

..hi guys..recently im doing some occlusion mapping and so far it is nice...im also trying to control specularity intensity over surface on level you see on provided image..I did try to increase value for specular reflection level in material editor, and play with some other values, but its just not affecting anything on level surface..basically i want to make it all more specular, so its look more frozen..i had this very nicely done when i was on 2.23, so since i switched to 2.3 i noticed, all specular levels i had before are actually way lower..so i need some tip about this thing since its really going on my nerves and even more since i know that im missing something trivial..or if anyone can provide some example of working material with textures attached so i can compare with my stuff, i will appreciate..thanks..

post-134-12621835044278_thumb.jpg

 

Link to comment
Share on other sites

Is this your own program where you loaded that mesh?

Make sure the buffer is created like:

TEntity buffer = CreateBuffer(640,480,BUFFER_COLOR0|BUFFER_DEPTH|BUFFER_NORMAL|BUFFER_COLOR2);

The last "|BUFFER_COLOR2" stores the specular intensity per pixel. Without it, you don't get any specular effects at all. This is new since some version after 2.2x (don't remember which one).

Before that, specular lighting just worked.

Link to comment
Share on other sites

Is this your own program where you loaded that mesh?

Make sure the buffer is created like:

TEntity buffer = CreateBuffer(640,480,BUFFER_COLOR0|BUFFER_DEPTH|BUFFER_NORMAL|BUFFER_COLOR2);

The last "|BUFFER_COLOR2" stores the specular intensity per pixel. Without it, you don't get any specular effects at all. This is new since some version after 2.2x (don't remember which one).

Before that, specular lighting just worked.

 

shouldn't this be built inside framewerk? the only place i see BUFFER_COLOR2 is for the reflection buffer...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

you edited your post before I had a chance to ask... but does the shininess slider work? I have tried all of the standard terrain textures that come with the SDK and I am not seeing any difference from when the slider is at 0 or at 100... what am I missing?

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

..hi guys..im sorry for late reply, I had to sleep a bit :lol:...I am using Framewerk with current example, because i wanna see how things works from all aspects before i start plugging/changing things on my own..so BUFFER_COLOR2 should be intact and I thought by changing specular value in material editor i could see more specularity or less..but its not the case...given example is not a terrain..its mesh terrain i have created, but i guess that shouldnt be an issue here since 2.23 worked just fine..so, other settings i have here is that sunlight(DirectLight) has intensity 0.5 while ambient light is 0.4 so thats the only additional parameters I have changed on my scene..for surface i use same shaders used in 2.23 with some addition for specular level introduced in 2.3..but it has no impact..sigh..

 

Link to comment
Share on other sites

I'm sure they do, but just to be sure, your DDS files have specular in the proper alpha channel for the shader you're using?

 

hmm..i dont have any specular map created (previous versions I used doesnt require that)..or I am missing something?? Do you mind, to post some code for proper specular bumpmap material so i can take a look and compare what i am eventually missing..its for sure that I havent created any specular maps simply because i thought its not necessary (since 2.23 i used before never require it)..

 

Link to comment
Share on other sites

Well it's not the code so much as the texture. If you're using a specular shader then the spec value should be in the normal maps alpha channel, then that spec value is multiplied by the spec slider to determine final spec value

 

#ifdef LW_SPECULAR
shininess = bumpcolor.w*specular;//*fOcclusionShadow
#endif

 

If you're using a separate specular map texture then it looks like it just looks at the red channel (which will be the same as the others if you're using a grayscale map):

 

#ifdef LW_SPECULARMAP
shininess = texture2D(LW_SPECULARMAP,texcoord).x*specular;//*fOcclusionShadow
#endif

 

If you're not using a specular shader then it looks like it will always have 0 specularity:

 

float shininess = 0.0;
...
shininess=clamp(shininess,0,1)*0.5;

 

0.0 * 0.5 will be 0.0.

 

So basically use one of the *specular*.frag shaders or one of the *specularmap*.frag shaders depending on if you're embedding spec into the alpha or want a separate spec map.

 

EDIT: If your normal map is an RGB8 texture (doesn't have an alpha channel) I'm not sure what the alpha value will be, quite possibly 0.

Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX

ZBrush - Blender

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...