Quantcast
Channel: Questions in topic: "hlsl"
Viewing all articles
Browse latest Browse all 206

A question about UVW.

$
0
0
Hello, everyone. I'm working on volumetric clouds, and i've ran into an issue i'd like to know more about. So basically i use a compute shader to generate a 3D noise texture. It doesn't really matter. ---------- Here is a part of debug shader i used to render my texture to a box while implementing noise compute shader: CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct appdata { float4 uvw : TEXCOORD0; float4 vertex : POSITION; }; struct v2f { float3 uvw : TEXCOORD0; float4 vertex : SV_POSITION; }; sampler3D _MainTex; v2f vert (appdata v) { v2f i; i.vertex = UnityObjectToClipPos(v.vertex); i.uvw = v.uvw.xyz; return i; } fixed4 frag(v2f i) : COLOR { fixed3 col = tex3D(_MainTex, i.uvw).r; return fixed4(1.0 - col, 1.0); } Nothing special here, but notice i take TEXCOORD0. ---------- Taking TEXCOORD0 gives me this result: ![alt text][1] Notice that it behaves as if it is a 2D texure, upper and lower planes are the same. So i've struggled a bit with that, and then changed a code to take TEXCOORD1. Now it gives the right behaviour: ![alt text][2] ---------- **So the question is:** Can someone briefly explain why doe's it work like that, or maybe point to a good advanced artice where can i read more about that? The scale is not an problem, but as you can see it also changes, changing the TEXCOORD index, would be nice to know why, also. I know this does matter on low level stuff and DirectX implemetation of Unity, but can't tie it all together :( [1]: /storage/temp/113236-screenshot-1.png [2]: /storage/temp/113237-screenshot-2.png

Viewing all articles
Browse latest Browse all 206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>