Last active
June 3, 2024 23:44
-
-
Save cecilemuller/8e8b093b1a85f2bcdbc361622e420b9f to your computer and use it in GitHub Desktop.
Revisions
-
cecilemuller revised this gist
Jun 3, 2024 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ USE_TEXTURE2D(tTexture0); void TriplanarEmissive( inout FragmentState s ) { vec3 uvw = fract(s.vertexPosition / 100.0 * uScale); vec3 blend = abs(s.normal); blend /= dot(blend, vec3(1.0, 1.0, 1.0)); @@ -14,10 +15,14 @@ void TriplanarEmissive( inout FragmentState s ) vec4 cz0 = texture2D(tTexture0, uvw.xy); float4 color0 = cx0 * blend.x + cy0 * blend.y + cz0 * blend.z; // Display the UV coordinates //s.emissiveLight = uvw; // Display the texture s.emissiveLight = color0.xyz; } #ifdef Emissive #undef Emissive #endif #define Emissive TriplanarEmissive -
cecilemuller created this gist
Jun 3, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #include "data/shader/mat/state.frag" uniform float uScale; //name "Scale" default 1.0 min 0.0 max 5.0 USE_TEXTURE2D(tTexture0); void TriplanarEmissive( inout FragmentState s ) { vec3 uvw = fract(s.vertexPosition / 100.0 * uScale); vec3 blend = abs(s.normal); blend /= dot(blend, vec3(1.0, 1.0, 1.0)); vec4 cx0 = texture2D(tTexture0, uvw.yz); vec4 cy0 = texture2D(tTexture0, uvw.xz); vec4 cz0 = texture2D(tTexture0, uvw.xy); float4 color0 = cx0 * blend.x + cy0 * blend.y + cz0 * blend.z; s.emissiveLight = color0.xyz; } #ifdef Emissive #undef Emissive #endif #define Emissive TriplanarEmissive