I have the following scenario: PBR material, HDR environment, and no lightning.
I want to apply the texture to it, so it looks just as it was uploaded.
If the albedo color of the material is white, it looks nice.
If I change the albedo color of the material, the texture is “coloring” into that color. So if my albedo is black, the texture is not visible at all.
If I put instead albedo texture lightmap texture, it looks good with black albedo. But it starts to looks weirder the brighter my albedo is.
I’m trying to understand the relation (if any) between these two and if there is a universal way to make texture look the same despite of the color of the material. E.g. if I have texture with black background and red dot on it, I want it to look exactly like that despite of what color albedo is. I basically “just” want to apply texture to a PBR material, as if it would be sticked on top of it, keeping the “realistic” look from HDR and kinda ignoring albedo color is underneath the texture.
Maybe the answer is that I should always force albedo to be white and that’s it? Because texture is always covering the whole material, so it doesn’t matter.
Also if you could also suggest some reading/book on PBR and those different types of textures I can see that Babylon supports.
@antmelnyk, I see what you are describing from the playground you linked, but I think I need a little more context before I can give you the best advice. You are correct that using an
albedoColor and an
albedoTexture together in one material will multiply the two before returning the final diffuse color before the lighting step. Typically, you would use one or the other in a default PBR material unless you wanted a bit of customization. Say for example you had an
albedoTexture of a racecar number in a black circle with the numbers in white on a white background. You could then use the
albedoColor value to change the color of the car and number at once. But you need to design the system around the two multiplying together unless you want to use a custom shader (node material).
Can you describe what you are trying to achieve (you can be generic about it if your project is still secret) by having both a color and a texture. In this case, the
albedoTexture fills the entire cube so you wouldn’t see any of the
albedoColor at all if they didn’t multiply together. You also show using a lightmap for your texture when the
albedoColor is black so I assume that you want the texture to be affected by lighting in your scene. I am also assuming you want the
albedoColor to be affected by scene lighting as well, so you won’t be able to tap into an emissive texture.
At first glance, I think you would need a custom shader using a node material which uses an alpha channel in your
albedoTexture to determine where the
albedoTexture shows and where the
albedoColor shows in your material. This is a simple lerp of the
albedoTexture and the
albedoColor using the alpha mask as the gradient. This output is then passed into the base color input of the
PBRRoughnessMetallic node in the node material editor (NME).
But I am not sure what your end goal here is so if you can give us a little more context, we can point you in the right direction.
Hello @antmelnyk just checking in if you need any more help?