≡
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: "Inter?ational"
(you are not logged in)
Text:
[quote][b]pmax[/b] wrote: I open this thread to post the code shaders. looking on the internet I found the code GLSL shaders, I have modified to CopperCube. Tried just filling in Winindows exe. PS: Translation by Google. [b]TOON_Shader[/b] [code]var vertexShader = "\n" + "varying vec3 normal;\n" + "\n" + "void main()\n" + "{\n" + " normal = gl_NormalMatrix * gl_Normal; \n" + " gl_Position = ftransform(); \n" + " \n" + "}"; var fragmentShader = "varying vec3 normal; \n" + " \n" + "void main() \n" + "{ \n" + " float intensity; \n" + " vec4 color; \n" + " vec3 n = normalize(normal); \n" + " intensity = dot(vec3(gl_LightSource[0].position),n);\n" + " \n" + " if (intensity > 0.95) \n" + " color = vec4(1.0,0.5,0.5,1.0);\n" + " else if (intensity > 0.5) \n" + " color = vec4(0.6,0.3,0.3,1.0);\n" + " else if (intensity > 0.25) \n" + " color = vec4(0.4,0.2,0.2,1.0); \n" + " else \n" + " color = vec4(0.2,0.1,0.1,1.0);\n" + " gl_FragColor = color;\n" + "\n" + "}"; var newMaterial = ccbCreateMaterial(vertexShader, fragmentShader, 0, null); var cube = ccbGetSceneNodeFromName('soldier'); ccbSetSceneNodeMaterialProperty(cube, 0, 'Type', newMaterial); ccbSetSceneNodeMaterialProperty(cube, 1, 'Type', newMaterial); ccbSetSceneNodeMaterialProperty(cube, 2, 'Type', newMaterial); ccbSetSceneNodeMaterialProperty(cube, 4, 'Type', newMaterial);[/code] [b]Example scene[/b] [url]https://www.dropbox.com/s/9iof99fukjjn20d/soldier_Toon_shading.ccb?dl=0[/url] [img]http://s27.postimg.org/qv4bcr5g3/soldier_toon_shading.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