Three.js Shaders Tutorial (part 2/2) | GLSL Shaders with Uniforms and Varying

  Рет қаралды 11,417

Suboptimal Engineer

Suboptimal Engineer

Күн бұрын

In this coding tutorial, we go over the basics of uniforms and varying variables in shaders. We start off by refactoring the GLSL code from the previous Three.js tutorial. Then we learn how to set up uniform variables. After that, we use the uniform variable to update our vertex + fragment shaders. Then we add a varying variable in our vertex shader and pass it to the fragment shader. We finish off by learning about how to use the varying variable in the fragment shader.
📖 Code - github.com/SuboptimalEng/thre...
🐦 Twitter - / suboptimaleng
💻 GitHub - github.com/SuboptimalEng
🌎 Website - suboptimaleng.com
== [ Resources ] ==
Three.js - threejs.org
Three.js Tutorials - sbcode.net/threejs
Discover Three.js - discoverthreejs.com
== [ Timestamps ] ==
00:00 Intro to Three.js Shaders
00:29 Refactor GLSL Shader Code
01:17 Set up GLSL Uniforms
03:05 Vertex Shader with Uniform
04:35 Fragment Shader with Uniform
05:24 Varyings in Pixel Shader
== [ Tags ] ==
#suboptimal #threejs #shaders

Пікірлер: 27
@supremebeme
@supremebeme 2 жыл бұрын
omg youtube algorithm came through clutch here... glad I found you!
@SuboptimalEng
@SuboptimalEng 2 жыл бұрын
Thanks Paul! Now I gotta hope it comes through on all my other videos 😂
@ffffffffffy
@ffffffffffy 2 жыл бұрын
Best tutorial for shaders hands down! You make it very digestible
@SuboptimalEng
@SuboptimalEng 2 жыл бұрын
Thanks Sharad 🙌🏾
@prodbyryshy
@prodbyryshy 7 ай бұрын
i appreciate you spending time on the vertex shader, most tutorials focus on the fragment shader, the vertex shader is also very interesting to me!
@SuboptimalEng
@SuboptimalEng 7 ай бұрын
Thanks!
@blokche_dev
@blokche_dev 2 жыл бұрын
Nice! Thanks for sharing. Short and clear.
@dvoraklovelace2801
@dvoraklovelace2801 Жыл бұрын
Really nice tutorials, thanks a lot!
@sherrywang8748
@sherrywang8748 Жыл бұрын
Thank you so much! It's really helpful for my assignment.
@user-uu9qu9ju2h
@user-uu9qu9ju2h 4 ай бұрын
This was a very nice introduction, would love some more parts, thank you
@SuboptimalEng
@SuboptimalEng 4 ай бұрын
I do have a lot more videos on fragment shaders. You can see my more recent videos!
@25314354
@25314354 2 жыл бұрын
Greta tutorial! hope there will be more advanced shader tutorials coming
@SuboptimalEng
@SuboptimalEng 2 жыл бұрын
I already have some on my channel like the audio waveform visualizer!
@Jeff-ze6td
@Jeff-ze6td Жыл бұрын
Best tutorial for shaders😆
@faridul.hassan
@faridul.hassan 10 ай бұрын
Just Awesome tutorial
@HuynhLuong227
@HuynhLuong227 11 ай бұрын
GLSL of your is pro, thanks for sharing
@RoniStudio
@RoniStudio Жыл бұрын
Nice tutorial, Can you make tutorial to apply texture from screen space to uv of a mesh?
@saubockmcgiver9743
@saubockmcgiver9743 Жыл бұрын
This really helped me thank you! Might be kind of a silly question, but can you tell me the name of your vscode color scheme?
@lucasa8710
@lucasa8710 2 жыл бұрын
this is very nice
@nskvJaguarzz
@nskvJaguarzz 2 жыл бұрын
Very cool video! Would you be able to use varying to pass the mouse position into shader and make it interactive?
@SuboptimalEng
@SuboptimalEng 2 жыл бұрын
You should be able to pass in mouse coordinates as uniform variables because they come from the web application. Once you do that, they will be available in both vertex and fragment shaders.
@ahmadsaerozi6688
@ahmadsaerozi6688 Жыл бұрын
Hi, are you know how to make shader material can receive shadow?
@roddlez
@roddlez 2 жыл бұрын
If your goal is to move towards being able to build a metaverse client, I suggest that you attempt to make a data-driven 3D engine. Currently, these demos have hard-coded scenes where the 3D meshes, shaders, etc are programmed directly into the app. I suggest that your next step should be choosing (or creating) either a data format or high-level language and then generating the scene from that (this is truly the big step from "I can make 3D appear on screen" to "this is a graphics engine.") Adding support for shaders to that will also be nice; for a minimally viable product, you could just have a diffuse shader that samples from an image file, and later on add support for something like PBR (physics-based rendering catches a fairly good chunk of the materials that skilled artists will use). The next step is providing support for interactivity to those 3D elements (with javascript), and later on down, support for a user's avatar (user presence within the scene and interaction), and then the harder work comes with network support (separation of client and server) plus object synchronization. If you can tackle all that, pat yourself on the back, you have a minimally viable metaverse engine.
@SuboptimalEng
@SuboptimalEng 2 жыл бұрын
Haha, at this point I might as well just use Unity and export to WebGL.
@sandeepGupta-ud2ns
@sandeepGupta-ud2ns 2 жыл бұрын
amazing
@yufengxiao9796
@yufengxiao9796 Жыл бұрын
谢谢!
@SuboptimalEng
@SuboptimalEng Жыл бұрын
Thanks Yufeng!
Introduction to Ray Marching
10:57
Suboptimal Engineer
Рет қаралды 14 М.
WHY IS A CAR MORE EXPENSIVE THAN A GIRL?
00:37
Levsob
Рет қаралды 14 МЛН
КАРМАНЧИК 2 СЕЗОН 5 СЕРИЯ
27:21
Inter Production
Рет қаралды 593 М.
100😭🎉 #thankyou
00:28
はじめしゃちょー(hajime)
Рет қаралды 47 МЛН
Three.js + Cannon.js Tutorial (part 1/2) | Intro to Physics with JavaScript
7:53
Three.js Shaders in 2 Minutes
2:00
Chris Courses
Рет қаралды 65 М.
Three.js Setup Guide Tutorial | Getting Started with React + Three.js
9:13
Suboptimal Engineer
Рет қаралды 29 М.
Three.js Tutorial on Shaders (beginners)
12:44
SimonDev
Рет қаралды 72 М.
Three.js + Tween.js Tutorial | How to Animate 3D Objects
6:54
Suboptimal Engineer
Рет қаралды 11 М.
What is Perlin Noise?
7:49
Suboptimal Engineer
Рет қаралды 10 М.
7 Examples Proving Shaders are Amazing
8:09
DesignCourse
Рет қаралды 31 М.
An introduction to Shader Art Coding
22:40
kishimisu
Рет қаралды 907 М.
WebGPU :: Rendering the future in Real-Time
17:03
Visionary 3D
Рет қаралды 192 М.
Не обзор DJI Osmo Pocket 3 Creator Combo
1:00
superfirsthero
Рет қаралды 1,2 МЛН
Which Phone Unlock Code Will You Choose? 🤔️
0:14
Game9bit
Рет қаралды 13 МЛН
Power up all cell phones.
0:17
JL FUNNY SHORTS
Рет қаралды 49 МЛН
Эволюция телефонов!
0:30
ТРЕНДИ ШОРТС
Рет қаралды 6 МЛН