Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

[core] Explore how we can integrate shaders and three-elements #55

Open
hmans opened this issue Feb 4, 2021 · 1 comment
Open

[core] Explore how we can integrate shaders and three-elements #55

hmans opened this issue Feb 4, 2021 · 1 comment
Assignees
Labels

Comments

@hmans
Copy link
Owner

hmans commented Feb 4, 2021

This is mostly a reminder for me to explore what kind of fancy, declarative glue we can provide for adding custom shaders to three-elements projects.

@hmans hmans added the research label Feb 4, 2021
@hmans hmans self-assigned this Feb 4, 2021
@hmans hmans changed the title Explore how we can integrate shaders and three-elements [core] Explore how we can integrate shaders and three-elements Feb 4, 2021
@CodyJasonBennett
Copy link
Contributor

CodyJasonBennett commented Feb 8, 2021

The two main workflows that come to mind are using <script> tags to write and reference shaders, or in JSX, point to a string (or compiled GLSL if they want to get fancy).

The main issue here is allowing the vanilla user to reference these shaders from the DOM.

Vanilla

<script id="vertexShader" type="x-shader/x-vertex">
  // vertex shader
</script>

<script id="fragmentShader" type="x-shader/x-fragment">
  // fragment shader
</script>

<three-shader-material
  uniforms="{ ... }"
  vertexShader="#vertexShader"
  fragmentShader="#fragmentShader"
></three-shader-material>

JSX

const vertexShader = '// vertex shader'
const fragmentShader = '// fragment shader'

<three-shader-material
  uniforms={{ ... }}
  vertexShader={vertexShader}
  fragmentShader={fragmentShader}
/>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants