Purpose of SpecularMap in a TerrainLighting?

Thanks for the screenshots and information! I will work on fixing it as soon as I can, and I’ll also make another thread soon for further testing and to see if anyone else has any ideas as to what can cause an issue that looks like this.

I currently would recommend using AdvancedPBRTerrain by default, and then if players lower a corresponding graphics options in your game’s settings you can convert back to the regular PBRTerrain that should be a bit faster.

But in the near future I will be adding some more optimization parameters to the AdvancedPBRTerrain shader so you can do things like enable triPlanar on a per-texture basis or cull layers easily, and this can be determined based on distance from camera and based on the graphics settings the player selected. So at that point the AdvancedPBRTerrain should be just as efficient as PBRTerrain and at that point I’d say AdvancedPBRTerrain should always be used in place of the regular one.

AdvancedPBRTerrain uses a TextureArray to bypass the 16 texture limit, so it is able to have higher detail from using a Metallic, Roughness, Ambient Occlusion, And EmissiveIntensity map, and you can use as many as your device can handle without lagging (which is why I’m working on params for easily adjusting this based on the game settings)

While the regular PBRTerrain just has a NormalMap and a regular albedo map because it will crash if there are more than 16 textures. Which means that the roughness and metallic values are only able to be set as floats, and specifically the lack of a detailed roughness maps ends up in unrealistically smooth reflecivity with this shader.

So the biggest visible difference is that AdvancedPBRTerrain can have much more realistic and detailed reflectivity and shininess.

Thanks for your time and efforts.
I think it will be best if I start integrating the AdvancedPBRTerrain into my editor.

1 Like

@yaRnMcDonuts , I have a question.
On the TextureArray of the different layers of textures on the AdvancedPBRTerrain, how would I be able to get the individual textures used after the material was saved?

In my editor, I want to display the individual layers of textures, however I can’t see how I can get these textures from the TextureArray provided.

I was thinking of adding the individual textures on the MaterialDef just for storage purpose, however, maybe there is a better way to retrieve it.

There is unfortunately no way to get the Textures back from a texture array, since TextureArray is created from a list of Image objects rather than Textures, so that means the TextureArray never knows anything about the Textures it was made from, nor their TextureKeys.

It could be a good idea to make a PR to the TextureArray class so that it stores all of the TextureKeys as Strings so you can atleast reload the original texture that way, this would just require a new constructor that takes in a list of Textures instead of Images


Another issue you may encounter with using a TextureArray is that there is no way to save/load them right now, so they also need re-created everytime the app is launched

I think that the TextureArray class could definitely use a lot of improvements, and I hope to address its shortcoming more sometime in the near future now that I’ve worked with the class for a while and am more familiar with it.


In the meantime, to bypass these shortcomings, I wrote my terrain editing tool to have a class called TextureArrayManager, and I give every TextureArray a unique a name, and then I save its TextureKeys to a .json file (I call it the TerrainTextureSlotCatalog).

Then I set the TextureArrays’ names as UserData strings on each of my terrains to keep track of which TextureArray that terrain is using, and I also set userData for each textureSlot layer to keep track of what index it is in the TextureArray.

Here’s a screenshot showing the properties of one of my terrains when I open it in the SDK so you can see how I save the TextureArray information to the terrain as UserData, and then use the values fetched from this UserData to look up the textures in my TerrainTextureSlotCatalog:

image

You can see that I set the “textureArrayKey” userData as “Silver_Shore_Gorge_Default” and then in a .json file I can use that name to look up what textures are a part of the “Silver_Shore_Gorge_Default” texture array. Then I use that information to load the proper textures, then create the texture array using those textures, and then finally I assign each TextureSlot to the correct index in the shader based on the TextureSlot names that are set to the UserData keys titled TexSlot_0, TexSlot_1, TeSlot_2, and so on (up until as many texture slots as you have set on that terrain)

1 Like

Thanks for the detailed reply.
Let me investigate how I could solver this from my side.