Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Examples shaders

karmacomposer
Registered User
Quote
2015-02-15 15:50:45

wrote:
@ karmacomposer

Copy the plugin into the folder "Documenti-> Coppercube-> Extensions".
Start CopperCube load the object specifically for the scene to be created.
Select "New 3D scenes 1" go to the "Behaviour", add the entry "Before drawing first do something" click on "Action", Add new undertake action "Scripted actions-> Assign shaders".
From this point you can go and read how the plugin in his post.
link:http://www.ambiera.com/forum.php...

PS: translation by Google


Thank you very much!!

I had no idea how to do this and could not find any. Manual entry or tutorials on this.

Not sure about the Material Index variable. The others I understand. How do I determine the Material Index?

Mike


Specularmap
Guest
Quote
2015-03-06 17:39:59

Thank you, Niko, for the beautiful long-awaited water!)

--
Please tell me how to use textures in shaders?
(envmap).
const vec3 Xunitvec = vec3 (1.0, 0.0, 0.0);
const vec3 Yunitvec = vec3 (0.0, 1.0, 0.0);
...
uniform sampler2D EnvMap;
...
vec4 envColor = vec4 (texture2D (EnvMap, index));

Where to specify the path to the texture or index?
Can this be so? envmap = "c: \\ mytexture.png"
--

And whether you can use a new material water on any node?
Can shader CC to be like the new water?


erik
Registered User
Quote
2015-03-07 16:42:56

I think you just need to set the texture in the material so that it can be used in the shader.


leo
Guest
Quote
2016-07-24 10:50:06

Hello it is possible to have "BLOOM" shader on Coppercube 5??

http://learnopengl.com/!Advanced-Lighting/Bloom

i would like to know if this effects can be adapted to object textures inside coppercube 5.

🔎︎



54newstar
Registered User
Quote
2016-07-24 19:57:16

What we should have is a shader selection took like in the textures or included with the textures shader. Once you save the text file in the shader file it should keep it there.


54newstar
Registered User
Quote
2016-07-24 19:59:25

I'd love a glow effect.


niksha
Registered User
Quote
2016-11-16 05:18:35

Sooo do these work on desktop? Not sure when basic bloom like shaders will be added to the engine.


marcw
Registered User
Quote
2020-12-09 14:00:17

Hi all,


I found interesting GLSL shaders in this topic.
Some of them contain little mistakes that I was able to solve.

It inspired me to create this experimental project that I share with this community (secured and anonymous access on my OneDrive) :

https://1drv.ms/u/s!AjokN1FU3jK1...

Thank you to the members who participated in that topic.




Robo
Guest
Quote
2020-12-11 11:31:55

cool - nice one, maybe that's how Niko added in post effects ?
I wonder if others can be added in....


marcw
Registered User
Quote
2020-12-11 13:57:40

@Robo, thank you for your comment.

I spent a few hours studying one of the first versions of the OpenGL Shading Language in the hope that I could add special effects in the real time rendering of Coppercube.

It requires much more time to learn in depth that language.
Discovering new nice shaders compatible with Coppercube requires a process going through trials and errors.

Compared to many other game engines, Coppercube is probably the easiest to learn and to use.

In my opinion :

Advantages :
The documentation is excellent.
The user interface is nice and particularly well thought (even though the editing process could be improved).
Games keep a compact size.
Good protection of the multimedia content.
Interesting features like this one : mesh editing (available in some versions).

Disadvantage :

Poor rendering of the rigged animated models.
(excerpt from the doc : "... Animated meshes don't support normal maps ...").

I am not sure that this disadvantage could be compensated by applying some shaders on the animated meshes, but I am still exploring the possibilities with the GLSL for the games published for the Windows OS.

If you want to experiment yourself with that language (preferably the oldest versions because there are more chances that their syntax is compatible with Coppercube), then you could have a visit in these links that I selected for my personal usage :

https://wiki.labomedia.org/image...


https://web.archive.org/web/2008...

https://www.ece.lsu.edu/gp/refs/...

http://mew.cx/glsl_quickref.pdf

https://web.archive.org/web/2006...

https://www.lighthouse3d.com/tut...

https://www.opengl.org//sdk/tool...

https://thebookofshaders.com/

http://learnwebgl.brown37.net/in...

(I particularly like the author's comment as excerpted here : " ... Note: WebGL requires programming and you are encouraged to experiment with sample code at each stage of your learning. Good programming practices use an incremental development cycle. You start development with a simple working program and use a simple cycle of implement/test, implement/test, implement/test, ... until you reach your goal. Rarely, if ever, should you program a complex WebGL program “from scratch.” Always start with a working program and add complexity slowly....).

For the French-speaking members of this community :


https://alexandre-laurent.develo...




marcw
Registered User
Quote
2020-12-11 21:37:14

var vertexShader = 
"varying vec3 P;\n" +
"varying vec3 N;\n" +
"varying vec3 I;\n" +
"void main()\n" +
"{\n" +
"//Transform vertex by modelview and projection matrices\n" +
"gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" +
"// Position in clip space\n" +
"P = vec3(gl_ModelViewMatrix * gl_Vertex);\n" +
"// Normal transform (transposed model-view inverse)\n" +
"N = gl_NormalMatrix * gl_Normal;\n" +
"// Incident vector\n" +
"I = P;\n" +
"// Forward current color and texture coordinates after applying texture matrix\n" +
"gl_FrontColor = gl_BackColor = vec4(1.0, 1.0, 1.0, 1.0);\n" +
"gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;\n" +
"}";

var fragmentShader =
"uniform sampler2D myTexture; \n" +
"uniform vec4 callback; \n" +
"varying vec3 P;\n" +
"varying vec3 N;\n" +
"varying vec3 I;\n" +
"float EdgeFalloff;\n" +
"void main()\n" +
"{\n" +
"vec4 col = texture2D(myTexture, vec2(gl_TexCoord[0]));\n" +
"float opacity = dot(normalize(N), normalize(-I));\n" +
"opacity = abs(opacity);\n" +
"EdgeFalloff = length(N);\n" +
"opacity = 1.0 - pow(opacity, EdgeFalloff);\n" +
"col *= gl_Color; \n" +
"//gl_FragColor = callback * opacity* (gl_Color.r+gl_Color.g+gl_Color.b);\n" +
"//gl_FragColor = callback * opacity* col;\n" +
"gl_FragColor = callback * opacity* (col.r + col.g + col.b + col.a);\n" +
"}";



myShaderCallBack1 = function()
{
var time = new Date().getTime();
//var pulse = (time % 500) / 500.0;
var color1 = Math.random()*1+0.5;
var color2 =Math.random()*1+0.1;
var color3 = Math.random()*1+0.2;
var color4 = Math.random()*1+0.5;

ccbSetShaderConstant(2, 'callback', color1, color2, color3, color4);
}



var newMaterial1 = ccbCreateMaterial(vertexShader, fragmentShader, 0, myShaderCallBack1);


var soldier = ccbGetSceneNodeFromName('soldier');
ccbSetSceneNodeMaterialProperty(soldier, 0, 'Type', newMaterial1);



I show here above one of the script included in this new GLSL for Windows project.

CCB file available on this link (secured and anonymous access on my OneDrive) : https://1drv.ms/u/s!AjokN1FU3jK1...

Each of the scripts of that project are placed in a separate "Behaviour" of the "New 3D Scene1".


count2rfeit
Registered User
Quote
2020-12-12 16:15:34

I really liked the 'strobe' effect on the blue soldier... could be a cool character feature in a horror game. have that chasing after you, huh?


marcw
Registered User
Quote
2020-12-12 20:08:01

@Count2rfeit, thank you for your comment.

I agree with your feeling about that strange blue soldier.

That could be the start of an interesting project.
You could try it with this upgraded version of that soldier :

Project : [ CCB + windows EXE (OpenGL mode) + 2 textures + commented screen capture ] uploaded on my OneDrive
(secured and anonymous access)


https://1drv.ms/u/s!AjokN1FU3jK1...




Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internation?l" (you are not logged in)


Text:

 

  

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