≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
Examples shaders
Posted by:
(you are not logged in)
Enter the missing letter in: "Internatio?al"
(you are not logged in)
Text:
[quote][b]Specularmap[/b] wrote: Your shader with a skull for some reason fails... --- That, I think, the first working and the desired shader for CC5,like metal *smile* float m = 5.0; shininess or power... Minnaert_reflection: [code] var vertexShader = "varying vec3 normal;\n" + "varying vec3 vpos;\n" + "void main (void)\n" + "{\n" + " // vertex normal\n" + " normal = gl_NormalMatrix * gl_Normal;\n" + " // vertex position (in eye-space)\n" + " vpos = vec3(gl_ModelViewMatrix * gl_Vertex);\n" + " gl_Position = ftransform();\n" + "}"; var fragmentShader = "varying vec3 normal;\n" + "varying vec3 vpos;\n" + "uniform float m;\n" + "void main (void)\n" + "{\n" + "float m = 5.0;\n" + " vec3 N = normalize(normal);\n" + " vec3 V = normalize(-vpos);\n" + " vec3 L = normalize(gl_LightSource[0].position.xyz - vpos);\n" + " // diffuse color\n" + " vec4 kd = gl_LightSource[0].diffuse * gl_FrontMaterial.diffuse;\n" + " // Minnaert reflection model\n" + " float NdotV = dot(N,V);\n" + " float NdotL = dot(N,L);\n" + " gl_FragColor = pow(max(NdotV * NdotL, 0.0), m) * kd;\n" + "}"; var newMaterial = ccbCreateMaterial(vertexShader, fragmentShader, 0, null); var soldier = ccbGetSceneNodeFromName('soldier'); ccbSetSceneNodeMaterialProperty(soldier, 0, 'Type', newMaterial); ccbSetSceneNodeMaterialProperty(soldier, 1, 'Type', newMaterial); ccbSetSceneNodeMaterialProperty(soldier, 2, 'Type', newMaterial); ccbSetSceneNodeMaterialProperty(soldier, 4, 'Type', newMaterial); [/code] [img]http://i.imgur.com/PBTTiHc.jpg[/img][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact