Home Unreal Engine

physical based shader questions

polycounter lvl 7
Offline / Send Message
joeriv polycounter lvl 7
So I have been looking into these physical based shaders, but I am running into some problems.

I don't have a lot of experience with shaders, so some of my questions will probably be very basic/stupid.
but because there aren't actualy shaders out there for download (except the maya one by Kodde), but that one doesn't work for me (ati card :poly117:) I kinda have no choice but to put it together myself.


Where I have problems is adding the cubemap reflections.
First the part of actually calculating those, I have put this together (see image), but the part where I have a problem is the back part of the equasion, since I am confused with the terminology.

One site says to use this:
FSchlick(cspec, v, n)

Another one says this:
FSchlick(cspec, l, v)

This is where I get confused and don't really know what to actually add to the back part. (1)
So if anyone could tell me what the actual inputs are in actual words that would be helpfull.

--

Second part is actually adding the cubemap reflections to the whole thing.

The normal one is (diffuse + specular)* dotNL
Do you add the reflections after the whole thing ((d + s) * dotNL)+ cubemapReflection
Or do you add them to the d+s part?

--

As you see I am missing the part where you blur the cubemap based on the roughness value. (2)
As I understand you generate multiple cubemaps and select the appropriate one based on the roughness value.

It seems a lot of work to generate let's say 4-7 cubemaps, and then go trough a whole thing to select the appropriate one (I guess with If's or lerps).

Could you actually just lerp between 2 cubemaps (the sharpest one, and the most blurry one) or will that cause problems.

--

And the last question:

I always liked the ambient light feature of xoliulshader.
If I want to add this is this the right way:

-Take a very blurry cubemap, multiply it by a constant, and then add it, or is there more to it.

(and same question here, where does it get added in this part "diffuse + specular)* dotNL")


58489769.jpg

Replies

  • lpcstr
    Options
    Offline / Send Message
    1. You use LdotH (or VdotH since they are the same angle) when calculating Fresnel for a microfacet BRDF. When you are calculating Fresnel for specular environment mapping, you use NdotV.

    2. Environment lighting doesn't go in your custom lighting. Even if you are using the built in lighting model, environment lighting always goes into the emissive channel.

    3. Ideally you would only have 1 environment map and you would store various convolutions in the MIP chain and using texCUBElod to select them. This isn't possible in UDK as it would require you to be able to access a cubemap from the custom node (possible, but only in a hackish manner) and to be able to import DDS cubemap textures while preserving the MIP chain (not possible.)

    4. I have no idea what xoliulshader is, but I'm going to assume you mean diffuse environment map. Generate your diffuse environment map (e.g. in HRDShop) and then use it like you would a specular environment map, only using the normal vector instead of the reflection vector.

    Here is a shader I provided in another thread.

    http://www.polycount.com/forum/showpost.php?p=1787202&postcount=10
  • joeriv
    Options
    Offline / Send Message
    joeriv polycounter lvl 7
    Okay, it all makes more sense to me now.

    Thanks a lot for the help :)
Sign In or Register to comment.