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

Where Is UNITY_POSITION(pos) Defined?

$
0
0
Hi All, I was hoping to copy and modify the following fragment shader in UnityStandardCoreForwardSimple.cginc: half4 fragForwardBaseSimpleInternal (VertexOutputBaseSimple i) { UNITY_APPLY_DITHER_CROSSFADE(i.pos.xy); FragmentCommonData s = FragmentSetupSimple(i); UnityLight mainLight = MainLightSimple(i, s); #if !defined(LIGHTMAP_ON) && defined(_NORMALMAP) half ndotl = saturate(dot(s.tangentSpaceNormal, i.tangentSpaceLightDir)); #else half ndotl = saturate(dot(s.normalWorld, mainLight.dir)); #endif //we can't have worldpos here (not enough interpolator on SM 2.0) so no shadow fade in that case. half shadowMaskAttenuation = UnitySampleBakedOcclusion(i.ambientOrLightmapUV, 0); half realtimeShadowAttenuation = SHADOW_ATTENUATION(i); half atten = UnityMixRealtimeAndBakedShadows(realtimeShadowAttenuation, shadowMaskAttenuation, 0); half occlusion = Occlusion(i.tex.xy); half rl = dot(REFLECTVEC_FOR_SPECULAR(i, s), LightDirForSpecular(i, mainLight)); UnityGI gi = FragmentGI (s, occlusion, i.ambientOrLightmapUV, atten, mainLight); half3 attenuatedLightColor = gi.light.color * ndotl; half3 c = BRDF3_Indirect(s.diffColor, s.specColor, gi.indirect, PerVertexGrazingTerm(i, s), PerVertexFresnelTerm(i)); c += BRDF3DirectSimple(s.diffColor, s.specColor, s.smoothness, rl) * attenuatedLightColor; c += Emission(i.tex.xy); UNITY_APPLY_FOG(i.fogCoord, c); return OutputForward (half4(c, 1), s.alpha); } But I get an error stating it doesn't recognize `VertexOutputBaseSimple`. If I include that it reads, "unrecognized identifier `UNITY_POSITION(pos)`". If anyone can point me in the correct direction I would greatly appreciate it! Thanks,

Viewing all articles
Browse latest Browse all 206

Trending Articles



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