|
|
|
|
|
Fixed mipmap seam...
- Posted on: 9/20/2018
[Uncategorized]
|
Success! I fixed the bug causing texture seams. Now the caustic effect is complete! |
I spent hours searching for a solution to the mipmap bug, tried every possible setting and solution - nothing worked. I discovered, instead of using "text2D" you can use "tex2Dlod" to manually specify the mipmap level. That fixes the bug. Unfortunately, I had no idea how to determine the current mipmap level to pass as an argument to that function. After a few more hours of searching and experimenting, I figured it out...
I get the distance from the camera to the object with this method:
dist = distance(_WorldSpaceCameraPos, i.worldObjectPos);
Then, set the mipmap level (lod) and grab the data like this:
fixed4 c = tex2Dlod (_MainTex, i.uv, 0, dist/100);
Note, dividing distance by 100 is an arbitrary way to normalize the value within an accepted range. I'm just learning shaders, there's probably a better way to accomplish this, but there's almost no information about this bug online, so I'm really happy to have found a solution!
I need to cleanup to shader code, then I expect to publish this asset for free or make a tutorial.
<< Back to main news page
|
|
|
|
|
|
|
Tropical Scene 8/1/2023 |
I made a tropical scene in Unity, just for fun. | |
Skybox AI 6/26/2023 |
I heard about this AI skybox generator and did a few tests in Unity. | |
Bobsled Game 3/7/2022 |
I recently watched the olympic bobsled event and got inspired to make a bobsledding game... | |
3D Viewer 1/1/2022 |
I made a simple program in Unity for viewing my 3d objects. | |
3d scene... 7/27/2021 |
A landscape scene I made in Blender... | |
Blender grass... 7/16/2021 |
An updated image of the different types of grass I made in Blender. | |
Grass... 7/14/2021 |
Different styles of grass... | |
|