Simple GLSL Shader Example?
4734 10 6- AlanZ
- Member
- 41 posts
- Joined: Feb. 2018
- Offline
I'm trying to learn how to write custom viewport shaders in GLSL, but couldn't find any up-to-date example. I read the relevant help pages (OpenGL Shaders [www.sidefx.com] and custom viewport shader [www.sidefx.com]), but still don't know how to implement basic things such as hooking up a diffuse map. Can anyone point me to a vanilla example?
Many thanks!
Many thanks!
- AlanZ
- Member
- 41 posts
- Joined: Feb. 2018
- Offline
- mestela
- Member
- 1737 posts
- Joined: May 2006
- Online
- rafal
- Staff
- 1448 posts
- Joined: July 2005
- Offline
The default GLSL shader produced with the steps listed in the second link you provided (https://www.sidefx.com/docs/houdini/shade/glsl.html) seems to work for me.
I tweaked the fragment shader to set the diffuse color to green, and the sphere appears green in the viewport. See attached.
I tweaked the fragment shader to set the diffuse color to green, and the sphere appears green in the viewport. See attached.
- AlanZ
- Member
- 41 posts
- Joined: Feb. 2018
- Offline
Thanks for the helpful replies mestela and rafal!
mestelaFollowing your suggestion I looked at Labs Quick Material. It's indeed helpful, but it's also the only one I found. Are you referring to any other labs materials that I'm not aware of?
Install sidefx labs, there's several example viewport materials in there that hook up to texture slots.
- mestela
- Member
- 1737 posts
- Joined: May 2006
- Online
- AlanZ
- Member
- 41 posts
- Joined: Feb. 2018
- Offline
- mestela
- Member
- 1737 posts
- Joined: May 2006
- Online
- dreamerflyer19
- Member
- 54 posts
- Joined: Oct. 2017
- Offline
rafalhi,how to enable to see the final effect??I got gray ball always
The default GLSL shader produced with the steps listed in the second link you provided (https://www.sidefx.com/docs/houdini/shade/glsl.html) seems to work for me.
I tweaked the fragment shader to set the diffuse color to green, and the sphere appears green in the viewport. See attached.
- Librarian
- Member
- 142 posts
- Joined: Aug. 2009
- Offline
https://forums.odforce.net/topic/43407-the-book-of-shaders-in-houdini-vex/ [forums.odforce.net]
I posted here at the and of the Topic link
https://serano-vfx-lab.hatenablog.com/entry/2020/07/13/170212 [serano-vfx-lab.hatenablog.com]
Here you have something that can be useful for learning
https://github.com/raganmd/BOS-in-TouchDesigner [github.com]
plus some file that I have Fun in process of learning
Have Fun
I posted here at the and of the Topic link
https://serano-vfx-lab.hatenablog.com/entry/2020/07/13/170212 [serano-vfx-lab.hatenablog.com]
Here you have something that can be useful for learning
https://github.com/raganmd/BOS-in-TouchDesigner [github.com]
plus some file that I have Fun in process of learning
Have Fun
Edited by Librarian - Jan. 22, 2021 04:02:54
- dreamerflyer19
- Member
- 54 posts
- Joined: Oct. 2017
- Offline
Librarianthanks your example,but still can not know how to change the effect by changing the parameters...
https://forums.odforce.net/topic/43407-the-book-of-shaders-in-houdini-vex/ [forums.odforce.net]
I posted here at the and of the Topic link
https://serano-vfx-lab.hatenablog.com/entry/2020/07/13/170212 [serano-vfx-lab.hatenablog.com]
Here you have something that can be useful for learning
https://github.com/raganmd/BOS-in-TouchDesigner [github.com]
plus some file that I have Fun in process of learning
Have Fun
-
- Quick Links