Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Object Fade

jdw6701
Registered User
Quote
2020-02-05 16:43:22

I'm trying to make a object in my scene fade into view after the scene itself fades in, but as usual, Coppercube doesn't have that option.

Could someone help a brother out and find a solution, cause if a 3D engine can't do something that Scratch, a child's play 2D engine, has built in, that's kinda sad.


veganpete
Registered User
Quote
2020-06-21 02:38:25

You can make several png textures with varying transparencies in an image editor such as GIMP. Export the images as transparent png's. In coppercube, set the texture type of your object to "transparent", then just change the textures of the object, in sequence, every few milliseconds. The object will fade in to view. Have the final texture as fully opaque so the object is not transparent. To fade out of view, simply reverse the load order of the textures. 4 textures changed at 250ms should fade your 3D object in/out over 1 second.


Robo
Guest
Quote
2020-06-22 01:40:04

jdw6701 wrote:
I'm trying to make a object in my scene fade into view after the scene itself fades in, but as usual, Coppercube doesn't have that option.

Could someone help a brother out and find a solution, cause if a 3D engine can't do something that Scratch, a child's play 2D engine, has built in, that's kinda sad.


Actually it does - just not well known.
Us the irrLicht settings /'Param1' to adjust the png image transparency with code over time. Range is from 0 - 1.
This works well with all static 3D objects - not sure about animated meshes though..


velli2
Registered User
Quote
2020-07-29 18:24:26

Actually it does - just not well known.
Us the irrLicht settings /'Param1' to adjust the png image transparency with code over time. Range is from 0 - 1.
This works well with all static 3D objects - not sure about animated meshes though..


I'm trying to do this without any success. Could you please provide more info or maybe an example project file?

I'm using the Set or Change a Variable action to change variable object.Param1. There is a hashtag but the forums seem keen on not showing it. Maybe I need to edit it using scripting but I'm not sure how I could do that.


Robo
Guest
Quote
2020-07-30 09:29:45

yes, you have to use code for that.

set up a variable called 'transparency and update its value over time with every x milliseconds....or use a on press key do something...

Try something like this code on item named 'object':

// fully transparent (1) to opaque (0)
var amt = ccbGetCopperCubeVariable("transparency");
var node = ccbGetSceneNodeFromName("object");
ccbSetSceneNodeMaterialProperty(node, 0, "Param1", amt);
print("transparency is: " + amt);

change as needed to suit what you want.
note 0 is texture slot 0 - or the first texture slot. In some cases might be multiple texture slots but generally is just the one texture slot with also a single texture for that slot (can use up to 2 textures with normals but 4 textures can be uploaded for each slot.


velli2
Registered User
Quote
2020-08-10 10:07:43

// fully transparent (1) to opaque (0)
var amt = ccbGetCopperCubeVariable("transparency");
var node = ccbGetSceneNodeFromName("object");
ccbSetSceneNodeMaterialProperty(node, 0, "Param1", amt);
print("transparency is: " + amt);

I did this and the code works just fine but the problem is that Param1 doesn't seem to actually affect anything. Fiddling with Param1 in the Irrlicht panel doesn't change opacity nor does the code during runtime. I have not seen Param1 change anything yet and have no idea what the problem could be.


Robo
Guest
Quote
2020-08-10 14:55:23

wrote:
// fully transparent (1) to opaque (0)
var amt = ccbGetCopperCubeVariable("transparency");
var node = ccbGetSceneNodeFromName("object");
ccbSetSceneNodeMaterialProperty(node, 0, "Param1", amt);
print("transparency is: " + amt);

I did this and the code works just fine but the problem is that Param1 doesn't seem to actually affect anything. Fiddling with Param1 in the Irrlicht panel doesn't change opacity nor does the code during runtime. I have not seen Param1 change anything yet and have no idea what the problem could be.


It will work if you use a png image file with transparency in it. I think TGA files can also have transparency. dont use JPG or BMP or other formats


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "In?ernational" (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