UE4 Cubemap in material. From reflection to ambient cubemap. How?


#1

Hi guys :slight_smile:

Cubemap captured by Cubemap Render Target can be easilly using with ReflectionVector node.
But how to make uv coordinate to using that cubemap as ambient cubemap?

Difference between reflection/ambient cubemap work greatly shown in that article.
https://geeks.ms/waveengineteam/2016/03/11/using-image-based-lighting-ibl/

Unfortunately i cant find any information about how to make “that” sort of UV coordinates.


#2

Cubemap UVWs are simply a world direction. The reflection vector is an incoming view vector reflected by the surface normal. For diffuse IBL it’s just the world normal. I don’t know if Unreal does automatic convolution of the mip maps (blurring), but choosing some constant low mip level should get you something that approximates IBL even if does not.


#3

Yeah i understand that ) But real solution are more complicated.
Cube capture in UE4 create Longitude-Latitude format cubemaps so making 3 channel vector uv become more complicated task.
By default UE4 only have “reflection vector” node for handle cubemaps as reflection maps, but doesnt have anything for ambient light (more simplier world direction projection).
And i just cant find information about how to making calculations for create 3vec data and handle Longitude-Latitude cubemaps as ambient maps.


#4

The long-lat layout should just be for convenient on-disk storage. Once imported it gets converted into an actual cubemap, which is a cube with 6 face maps, hence the name. And any texture being generated in real-time by Unreal is going to be an actual cubemap until it’s exported.

Presumably you have your cubemap as a texture property, and you’re feeding the output of the Reflection Vector into your Texture Sample node that’s using that cubemap texture, yes? Just don’t use that and use the output of a PixelNormalWS instead.

If instead you do actually have a long-lat texture you’re using straight, consider importing it as a cubemap. Or you’ll have to convert the xyz world vector into polar coordinates.


#5

Maybe im just named it wrong way?


thats what we got by using scene capture cube in UE4.
At least it looks like typical long-lat cubemap, no?

I find solution: absolute world space - object position = UV for “that” cubemap.
But yes, PixelNormalWS gives absolutely same results! Thanks :slight_smile: