Jump to content

"Specular" Shader for models


Recommended Posts

Posted

Hey,

 

I was just wondering if its possible to make some kind of specular shader working for models. Since the standard shader just works vertex based, its kind of useless for bigger models (unless one tesselates the object). What I thought of is an environment mapping stage with the specular map as an opacity value for it. Has anyone an idea how to archive it? Or is it even possible?

Maybe doubling the model and use the transparency for the "decal/reflection" model and use the environment stage there?

 

Thanks in advance.

Posted

Hey,

 

I was just wondering if its possible to make some kind of specular shader working for models. Since the standard shader just works vertex based, its kind of useless for bigger models (unless one tesselates the object). What I thought of is an environment mapping stage with the specular map as an opacity value for it. Has anyone an idea how to archive it? Or is it even possible?

Maybe doubling the model and use the transparency for the "decal/reflection" model and use the environment stage there?

 

Thanks in advance.

 

it's easily possible. is sufficient a specific SHADER file for a model that apply this rendering feature on the textures.

you can do by yourself making a custom shader file. is possible to edit shader file open them with notepad.

Posted

it's easily possible. is sufficient a specific SHADER file for a model that apply this rendering feature on the textures.

you can do by yourself making a custom shader file. is possible to edit shader file open them with notepad.

Oh, you misunderstood me. I "know" how to write shaders. The problem is that the specular pass computes the light reflection based on the vertexes and not based on the screen pixels. The result is a not very accurate specularity unless the model is crazily tesselated or very small (like a lightsaber).

 

So my idea was to fake the spec shading somehow. Easier question. When I use an model with transparency, does the environment stage get transparent on the transparent parts too? Second one, can I use a dublicate model on the same position with some kind of sorting to be "on top of the other" without z-fighting?

  • 2 weeks later...
Posted

can I use a dublicate model on the same position with some kind of sorting to be "on top of the other" without z-fighting?

 

Model wise it's quite easy to do, duplicate model and add something like a push modifier set to 0.01, it just offsets the model enough to get rid of the z-fighting. If you're asking shader wise...i'm not sure that's even possible.

Posted

it is possible, use the specmap as the alpha channel for your diffuse.

then have a 3-4 layer setup in your shader:

 

Optional lightmap stage

diffuse with no alpha

env map

diffuse map with inverted specular map in alpha

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...