This file contains 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 characters
Shader "Pristine Grid" | |
{ | |
Properties | |
{ | |
[KeywordEnum(MeshUV, WorldX, WorldY, WorldZ)] _UVMode ("UV Mode", Float) = 2.0 | |
_GridScale ("Grid Scale", Float) = 1.0 | |
_LineWidthX ("Line Width X", Range(0,1.0)) = 0.01 | |
_LineWidthY ("Line Width Y", Range(0,1.0)) = 0.01 |
This file contains 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 characters
import * as THREE from "three" | |
// credits for the box-projecting shader code go to codercat (https://codercat.tk) | |
const worldposReplace = /* glsl */` | |
#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) | |
vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 ); | |
#ifdef BOX_PROJECTED_ENV_MAP | |
vWorldPosition = worldPosition.xyz; |