「利用者・トーク:Moguri/GSoC Shaders Docs」の版間の差分

提供: wiki
移動先: 案内検索
(Custom Uniforms)
 
(1版 をインポートしました)
 
(相違点なし)

2018年6月29日 (金) 04:45時点における最新版

Custom Uniforms

It would be good if we could specify game properties as custom uniforms.

Also (for advanced users) it would be nice to be able to specify any Python expression. Or at least a set of predefined ones. Particularly, I'm thinking of the view matrix, the inverse view matrix, the model matrix, the inverse model matrix and transposed versions of all of them. For example, the inverse view matrix is available in Python as

bge.logic.getCurrentScene().active_camera.camera_to_world

--Martin Kraus 10:31, 11 August 2011 (CEST)

Additionally, it would be good to be able to optionally specify vec3 and vec4 uniforms with the help of Blender's RGB and RGBA color selector. If possible, a way to link a uniform to a position (e.g. the translation of an object) would also be cool. --Martin Kraus 14:50, 11 August 2011 (CEST)
Oh, and "samplerCube" should be supported. --Martin Kraus 09:59, 12 August 2011 (CEST)

RNA values

I'm not sure whether I can access "RNA values" (I've no idea what that is) but in a GLSL shader I can access the diffuse color (including alpha) specified in the object tab of the properties window with

gl_FrontMaterial.diffuse or gl_BackMaterial.diffuse

and the specular color in the material tab of the properties window with

gl_FrontMaterial.specular or gl_BackMaterial.specular

and the product of the diffuse color and emit in the material tab with

gl_FrontMaterial.emission or gl_BackMaterial.emission

(A complete list is at this page.)

I'm not sure that makes the use of ad-hoc defined uniforms "diffuse_color", "specular_color", "alph", "emit" superfluous, but it sure is more compatible with other systems.

--Martin Kraus 10:30, 11 August 2011 (CEST)