𓅹 kitasenju design blog 𓅸

humans are imperfect

ShaderMaterial雛形

import * as THREE from 'three';
import { PlaneGeometry, TextureLoader } from 'three';
import shaderVert from "../glsl/shader1.vert";
import shaderFrag from "../glsl/shader1.frag";

export class MyPlane extends THREE.Mesh {

    constructor(){

        let loader = new TextureLoader();
        let texture = loader.load("emoji1.png");

        let material = new THREE.ShaderMaterial({
            uniforms: {
                tex:{value:texture}
            },
            vertexShader: shaderVert,
            fragmentShader: shaderFrag,
            side: THREE.DoubleSide
        });
        material.transparent=true;

        super(
            new PlaneGeometry(1000,1000,1,1),
            material
        );

    }


}

varying vec2 vUv;

void main() {
    vUv = uv;
    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
〠FOOTER〠