Okay, so I’ve been racking my brain trying to figure out how to do this. Basically I have an Earth model (it’s just a sphere with specified UVs), and I have 32 8K textures that go across the surface. You may be wondering why not just use one texture; well I’m trying to get the most texel density, so that when you zoom in really close to it, it isn’t pixelated. What I currently have is a sphere with 32 separate material ID’s, with each map being it’s own texture. This is a lot of draw calls, I know, but this isn’t meant to be used in a game, and it’s the only object really in the scene. So off the bat, performance is not an issue. This technique works great for an Opaque material, however where it fails is with translucent materials. Currently UE4 has a limitation on the “Dynamic Shadow Distance” for both movable and stationary lights on Cascaded Shadow Maps . My earth is gigantic in the scene, and because of this my camera distance well exceeds the cap of 20,000 units, thus my translucent clouds that surround the earth are not receiving the appropriate shadows. To get around this I created a hemisphere mask around the cloud texture; this works well if it is a single texture, but fails when I try to break it up into 32 separate textures (obviously).
A forum post about the Cascaded Shadow Map issue can be found here, yet to be solved:
So here’s the issue/the idea. If I’m able to combine the 32 Textures into 1 material, the hemisphere mask will work, but pulling this off has been quite the challenge. The base idea behind this
video works well, BUT it only works for 2 materials! and because the material editor doesn’t have any other conditional nodes such as: ‘else’ or ‘and’, I can only ever compare two numbers.
I tried to write a custom HLSL node, but soon realized I have no clue what I’m doing and there is so little understandable documentation on HLSL.
SO! What I want is to take the UV coords, and compare the U to a range of 8, and the V to a range of 4, and then apply a specific material depending on the UV values.
EX: If U=1 and V=1 apply texture A1-1, if U=2 and V=1 apply texture A1-2, if U=1 and V=2 apply texture A1-3, if U=2 and V=2 apply texture A1-4. It’s really extremely basic logic, but again the material editor only has if statements.
I’ve tried running it through multiple if statements but it always overwrites the first texture input. I’ve also tried using lerps, and it actually does start to put them in the right place, but if i ever change the alpha to 0 or 1 in order to get a solid image, it breaks.
Anyone know a solution to this? I know blueprints have much more logic to them, but I wouldn’t really know where to start in connecting it to a material.
Here is what I’m going for, this is the current model. Looks great from far away, but if you get close you would find the clouds and the lights to be pixelated.