开发者

RenderMonkey - GLSL light

开发者 https://www.devze.com 2023-02-06 08:06 出处:网络
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 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_LightSour开发者_运维知识库ce[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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消