r3f-shaders

Generate custom GLSL shaders for React Three Fiber applications.

Updated Dec 22, 2024
One-click install
npx skills add https://github.com/nicolas-ricc/oort --skill r3f-shaders-nicolas-ricc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: r3f-shaders
Source: https://github.com/nicolas-ricc/oort/tree/main/apps/frontend/.agents/skills/r3f-shaders
Command: npx skills add https://github.com/nicolas-ricc/oort --skill r3f-shaders-nicolas-ricc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables the creation of custom visual effects and advanced material properties in React Three Fiber (R3F) applications by leveraging GLSL shaders.

Core Features & Use Cases

  • Custom Shader Materials: Define unique materials using GLSL for vertex and fragment shaders.
  • Uniforms and Varyings: Control shader behavior and pass data between shader stages.
  • Use Case: Apply a dynamic wave effect to a plane geometry, create a dissolve effect for object transitions, or implement a custom lighting model.

Quick Start

Use the r3f-shaders skill to create a custom shader material with a time-based color shift effect.

Frequently Asked Questions about r3f-shaders

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create custom GLSL shaders for React Three Fiber applications?

To create custom GLSL shaders for React Three Fiber, you can define unique vertex and fragment shaders to build custom materials. This approach enables advanced visual effects and dynamic rendering by directly programming shader logic within your R3F components.

Can I use shaderMaterial from @react-three/drei to build custom materials?

Yes, you can use shaderMaterial from @react-three/drei to build custom materials. The Skill supports this helper alongside raw THREE.ShaderMaterial, providing detailed control over vertex and fragment shaders, uniforms, varyings, and texture sampling.

What visual effects can I achieve by writing custom shaders in R3F?

Writing custom shaders in R3F allows you to achieve visual effects like dynamic wave distortions on plane geometry, object dissolve transitions, and custom lighting models. These are created by manipulating material properties through GLSL programming.

How do I pass data between vertex and fragment shaders in React Three Fiber?

To pass data between vertex and fragment shaders in React Three Fiber, you use varyings. You can also use uniforms to control overall shader behavior dynamically, allowing you to pass data from your React application directly into the GLSL shader program.

Do I need to know GLSL to implement custom materials in React Three Fiber?

Yes, you need to know GLSL to implement custom materials in React Three Fiber using this approach. Writing custom shader materials requires programming the vertex and fragment shaders directly to define unique visual properties and dynamic rendering behaviors.

Why use raw THREE.ShaderMaterial instead of standard R3F materials?

You use raw THREE.ShaderMaterial instead of standard R3F materials when you need detailed control over vertex and fragment shaders. This allows you to implement advanced visual effects, custom lighting models, and precise texture sampling beyond basic material properties.