Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Feature requests and bug reports
Lightmapping [BUG]

veganpete
Registered User
Quote
2023-05-08 13:05:33

Just to let people know, if you use an animated textures in a scene, you can't use lightmapping/static lighting for the scene - otherwise your textures/material slots will randomly become jumbled (eg your walls will have floor textures etc).

Whenever I calculate lightmapping for a scene that has animated texture action applied to any material slot, coppercube gets confused and applies the animated texture to random material slots throughout the entire scene, after calculating the lightmap.

I'm thinking coppercube can't calculate lightmaps for a scene that has an animated texture action applied to it?

Workaround......A workaround is to reload all the meshes (to restore the correct material slots/textures), then remove all the animated texture actions before calculating the lightmapping, then calculate the lighmapping, then use the mesh-editor to select (by triangles) the geometry you want to apply an animated texture to, then double-click a texture to create a new material slot for the mesh, then apply the animated texture to the new material slot. After doing this, be warned, if you recalculate the lightmapping, it will break the animation and you'll have to reload the mesh and repeat the procedure to fix it.

*To get transparency to work properly after calculating lightmapping, you need to enable transparent (alpha) and disable "backface culling" in irrlicht settings.


just_in_case
Moderator
Quote
2023-05-08 16:18:00

@VP, there is no bug with the "Animate Texture", Lightmapping doesn't work with Transparent textures, so make sure that you aren't using transparent textures when lightmapping your scene.

so if your object has multiple materials type for example, solid, and transparent or solid fake reflective. Then if you calculate lightmaps, then there are chances that it will generate extra materials for your object. That is why your "Animate Texture" behavior gets messed up, due to generation of extra materials.

The best to test this out is simply add the "armchair" model that comes by default in Coppercube prefab. You will notice that it has 2 materials slot, and has different materials type assigned to both of them, one is "Solid" another one is "Solid Fake Reflective" and when you do the lightmapping, just check out the number of materials, you will notice that it now has "3" materials, while previously it was using only 2 materials.

So this generation of new materials is causing the issue for you.

When you are reloading the mesh, it is loaded with all the materials type as solid, that is why it is not causing any issue.

The best you can do here, so that you can have the lightmaps, and don't want to get your materials messed up, with the animate texture behavior and if you don't want to reload the mesh. is that you use the vertex color based lighting.

In order to do Vertex Color based Lighting, simply increase Resolution to higher value like "1000000" when you calculate your lightmaps, but make sure your material type is "solid" when you were calculating the lightmaps, once the lighmaps get calculated, you can simply change the material type, you can change it to transparent, fake reflective whatever you wish. and the lightmaps will work fine, even with the transparent object.

It will save you from doing the polygon selecting thing and reloading the mesh, as it won't generate new materials, and will work just fine even if your object has "Animate Texture" behavior applied to it.


Hope this helps


VP
Guest
Quote
2023-05-08 19:15:50

Thanks just_in_case, yeah that does work! Man,you know a lot of stuff. With vertex lighting though, the shadows just doesn't look anywhere near as good, to me, at such a low resolution.

Also, it doesn't seem to be only the transparency that's breaking the animations, it still screws up even when there are no transparent textures in the scene (eg:all solid textures), any animations are still being converted to a single frame after lightmapping - although, as you said, the materials do retain the correct slot-number when not using transparency. Vertex lighting does also fix this - the animation works after calculating the lighting.

After your good advice, I still think I'll apply the lightmapping, then add transparency, then add animated textures using the polygon editor - much more work, but it looks a lot better in my opinion.

By the way,would your animated2D plugin help with this at all? I've tried to use it again but can't got it working - I can successfully create an animation node with it but when I try to apply the animation (using "Set Animation") to a node material, nothing seems to happen. As usual, I'm probably doing something wrong or trying to make it do something I'm not designed to.

Thank you.


VP
Guest
Quote
2023-05-08 19:32:09

Update- selecting individual polygon triangles doesn't let you add an animation to a new material after lightmapping, it does add a still frame, but screws up the animation - only one triangle is animated, the rest and static.

Doesn't matter, I'll keep trying and find a way to get animated textures to work with lighmapping - probably I'll split the mesh and lightmap part and animate the texture of the other, then merge them together in the polygon editor - if that doesn't work, I'll keep the meshes separate. If this is not a bug, I somehow feel like this should be easier to do.


VP
Guest
Quote
2023-05-08 21:01:25

OK, I think I figured it out. When you add an animated texture, it gets assigned to a single material number. Now, if you calculate lightmapping for the scene, the lightmapping appears to assign new material numbers to the scene. Because the single animation instance is applied to the old single material number, it screws up - you can't easily fix it because animated textures can only be assigned to a single material number, not multiple materials - so, as a workaround, you have to add multiple instances of the same animated texture, then apply them to the multiple material slots, then animated textures will work properly (with lightmapping). The only issue is that you have to guess which slot is for which texture and it's a nightmare to get right because if you guess wrong just once, you cant undo it after you assign the animated texture to a material slot, you have to reload the mesh and start again with the lightmapping. Pretty much impossible to do a single scene, I have 195 scenes to do in total. I wish the animated texture would automatically assign to the new material slots when lightmapping, just like any other ordinary texture does - otherwise there doesn;t seem to be a reliable way to use animated textures after calculating lightmapping of a scene.


VP
Guest
Quote
2023-05-08 21:08:00

One last thought to get it working, I could try to convert the animated frames to a video file and then use play video instead of animate texture.


VP
Guest
Quote
2023-05-08 21:32:10

[SOLVED]

Sorry for the multiple posts,managed to fix it by splitting the mesh and childing the second mesh to the first, then applying the lighmapping to the scene (both meshes), then applying the animated texture to the second mesh. It's now animated, light mapped and fogged - looks great but had to add 11 instances of the same animation to assign it to the various new lightmapped materials.

Thanks for all the help, got there in the end!


just_in_case
Moderator
Quote
2023-05-16 13:36:55

@VP, I just realized that I already have a video on the usage tutorial for the animation scripts collection, if you can give it a shot, I am pretty damn sure, that my extension will be going to help you a lot when working with 2D animated textures.

here is the link to the video, https://www.youtube.com/watch?v=...

if you can try following the tutorial to set and change the animation, and let me know if it works for you or not. you can confirm if you are doing something different other than what I am doing in the video.


veganpete
Registered User
Quote
2023-05-16 14:36:18

Thanks, just_in_case I did manage to get it to work this time but the original problem still occurs - lightmapping completely removes the animations.

Other than that, there are two other issues which prevent the plugin from being perfect for me....

1) Because my scene's materials are split into many sections, I have to add the "set animation" action multiple times (one for each new material slot) otherwise only a tiny part of the original texture is animated. If you could add a feature to apply the same animation to multiple selected materials, that would be great!

2) Also, another urgent update would be the naming convention - it expects the user to have the following:

"frame1"
"frame2"
"frame3"

etc..

It would be better (for me) if it asks for:

"frame(1)"
"frame(2)"
"frame(3)"

etc...

Because windows bulk rename files in this manner, by selecting all files (ctrl+a) and then "rename file" as "frame", it automatically adds the numbers in brackets.

In order to use frames with the plugin, I have to manually rename each one, so it's actually quicker at the moment just to use coppercubes animate texture feature instead of the plugin, because I can just load the frames individually without having to rename them all first.

But if you can change those two features: "apply animation to multiple materials" - and - accept "frame(1)" as a frame name, instead of "frame1) it'd be a really great plugin and save me loads of time.

...also, I noticed if the plugin ever fails to create the animation (for whatever reason), it still adds it as a blank node to the scene. It would be better not add any empty/failed animation nodes to the scene.

Thanks for our help and time with this. Much appreciated.


just_in_case
Moderator
Quote
2023-05-16 16:53:34

Yeah, you are right the plugin strictly uses "Frame1", "frame2", "frame3" , and so on. but you should have a batch script that comes with the animation scrips, that simply removes the brackets from the renamed files in Windows. All you have to do is simply copy and paste the "sequentialFileNameCleaner.bat" to the directory where the textures files or the animation frames are and simply run the batch script, it will rename all the frames by removing the brackets () around them, so you don't have to manually rename each of the files, maybe you somehow missed the batch script files that comes with the scripts pack.

or maybe you are right, I will update the plugin so that it will use "frame(1)", "frame(2)" and so on.

For the multiple materials, support. I first need to confirm if you mean that you want to apply the same animation to all the material slots of an object, or to specific materials, as tomorrow I am going to release the animation scripts pack as separate assets, I might update it so that it can support multiple material slots animation as well.

Thanks for the suggestions I will likely going to add them in the next update. Cheers :)


Vp
Guest
Quote
2023-05-16 17:30:42

Thank you just_in_case - that's perfect!

Ah, so that's what the sequential clean-up script is for - I wondered what it was - I'd prefer it to look for "frame(1)" automatically, but it's not essential if the separate batch file can do it.

As for the materials, it would be good for me to be able to apply the animation to separate/individual materials eg:

"Waterpool" animation affects materials 1, 2, 6 and 9.
"Waterfall" animation affects materials 3, 5 and 8.
"Lava" animation affects materials 10 and 11.

At the moment, I have to do copy the action, like this:
"Waterpool" animation affects material 1
"Waterpool" animation affects material 2
"Waterpool" animation affects material 6
"Waterpool" animation affects material .
"Waterfall" animation affects material 3
"Waterfall" animation affects material 5
"Waterfall" animation affects material 8
"Lava" animation affects material 10
"Lava" animation affects material 11

It works, but it's a lot more work than necessary.


Thanks man, and congrats on making such a good plugin.

In the future, it would be a nice feature to have different play modes:

Play once [ ]
Play looped [ ]
Play reversed [ ]
Play ping-pong [ ]


just_in_case
Moderator
Quote
2023-05-16 18:28:47

Thanks, will add the additional features, there is already, Loop, and Play once in the extension, you can simply turn off the "looping" check box so that it will play once only, and check the "looping" to make it continuosly play the animation. Will add the reverse and ping Pong, and will also add ability to make it work on 2D overlays too.
If you have any other suggestions then let me know, I will add those in. Regarding to be able to apply single animation on specific materials, I will add that ability as well. So that you don't have to attach multiple actions and one single action will serve as the base for specific materials of an object.


VP
Guest
Quote
2023-05-16 19:15:21

Perfect! Thank you just_in_case.


VP
Guest
Quote
2023-05-16 19:22:13

One final suggestion, probably as a major update, would be...

"on specific frame", do action.

eg: on frame 20, "play sound: waterdrop.wav" etc.

May be too difficult to implement but thanks again.


just_in_case
Moderator
Quote
2023-05-17 16:21:29

I updated a few things that you requested but had power down for the last 5+ hours, so today was a waste, will work a bit more on it and then update the same on itch.io, and yeah it will be totally possible to execute an action on a specific frame.


Create reply:


Posted by: (you are not logged in)


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