RenderMonkey - GLSL 光
我正在使用聚光灯制作一个着色器,在制作自己的着色器之前,我正在尝试一些在互联网上找到的着色器。 我找到了这个 GLSL 代码:
vec4 Final_color = (gl_FrontLightModelProduct.sceneColor * gl_FrontMaterial.ambient) + (gl_LightSource[0].ambient * gl_FrontMaterial.ambient);
有谁知道我怎样才能在 RenderMonkey 中做到这一点?我知道我不能使用 gl_LightSource[0],我该如何制作呢?
I am making a shader in witch i am using a spot light, I am trying some shaders that I´ve found in the Internet before I make my own.
I found this GLSL code:
vec4 final_color =
(gl_FrontLightModelProduct.sceneColor * gl_FrontMaterial.ambient) +
(gl_LightSource[0].ambient * gl_FrontMaterial.ambient);
Does anyone know how can i make this in the RenderMonkey? i know that i cannot use gl_LightSource[0], how can i make it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 rendermonkey 中,您需要为着色器将使用的灯光属性设置变量。这样的 aa vec4 代表光的环境色、漫反射色和镜面反射色。然后是一些 vec3 作为到光/光位置的矢量等。
然后您可以将这些变量设置为艺术家变量,并且可以在右侧的艺术家编辑器中“实时”编辑它们。
这有点尴尬,这意味着您需要调整着色器的使用,以便不依赖内置的 gl_ 构造(因此您不需要编辑着色器即可在您的程序中运行,并且在 RM 中,或者当您介于两者之间时需要编辑着色器。
In rendermonkey you would need to set variables for the light properties which your shader would use. such a a vec4 for the light's ambient, diffuse, and specular colors. Then some vec3 for the vector to the light / position of the light, etc.
Then you can set these variables to be artist variables, and you can edit them 'live' in the artist Editor on the right.
It's a bit awkward, meaning that you either need to adjust your usage of your shader such that you don't rely on the built in gl_ constructs (so you don't need to edit a shader for it to run both in your program and in RM. Or you need to edit the shaders when you go inbetween. I prefer the former.