Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bake lighting? #95

Closed
verypleasentusername opened this issue Oct 14, 2023 · 8 comments
Closed

Bake lighting? #95

verypleasentusername opened this issue Oct 14, 2023 · 8 comments

Comments

@verypleasentusername
Copy link

I didnt find any way to bake lights on cyclops-made geometry. It would be really handy to know how to do that, or at least where to start with my own implementation. Thanks.

@blackears
Copy link
Owner

The problem with this is that MeshInstance3Ds that are generated in the editor can't have lightmaps baked unless their 'owner' property is set. But if the owner property is set, it will cause extra copies of it to be created every time you save and load the scene. I think there was some discussion of having the owner requirement removed to allow for baking, but this is something in Godot itself and I don't know if they're going to change this.

godotengine/godot#76886

If you're using the 1.0.2 dev version, you can export your scene to a gltf file and then use that for lighting.

@verypleasentusername
Copy link
Author

The problem with this is that MeshInstance3Ds that are generated in the editor can't have lightmaps baked unless their 'owner' property is set. But if the owner property is set, it will cause extra copies of it to be created every time you save and load the scene. I think there was some discussion of having the owner requirement removed to allow for baking, but this is something in Godot itself and I don't know if they're going to change this.

godotengine/godot#76886

If you're using the 1.0.2 dev version, you can export your scene to a gltf file and then use that for lighting.

uh.... is the ``latest version``` is 1.0.2?
also isnt the CyclopsBlocks an owner of Blocks nodes? i mean if you move it to another scene and modify children(blocks) by enabling "modify children" flag. Also creating copies of nodes by setting owner property is really weird and.... its probably a bug? anyway i think it can be fixed by creating actual MeshInstances as you use blocking tool. so Instead of theoretical Meshes that we see in editor(which are ment to be replaced by actual Mesh3D) we ACTUALLY make an mesh node as we create a new block. It would make a bit of overcomplication since it would create a node branch for every block. also i have an idea to have "workspace cyclops" and "baked cyclops" scenes. in one you just work, and when you're done or want to test the map you can do it as easily as hitting a special button on toolbar which will automaticly reaplace workspace for baked space, with every block being an array instance in a parent node. From there you can add props and bake lighting. Should be easy to implement, dont you think? Thanks.

@blackears
Copy link
Owner

The block nodes create a MeshInstance3D for displaying the geometry, a collision shape for the collision and also an occlusion node and they are all added as children to the block node. However, this is done by a script running in the editor so they do not appear in the scene. I believe they would appear in the scene if I set the owner property, but then this is going to cause issues during loading and saving since Godot will create and manage a separate copy of them rather than letting me create them in the _ready method of the block node. I'd also rather not have the user manually changing and possibly deleting these nodes if they have direct access to them.

@blackears
Copy link
Owner

And yes, I meant 1.0.2.

@verypleasentusername
Copy link
Author

The block nodes create a MeshInstance3D for displaying the geometry, a collision shape for the collision and also an occlusion node and they are all added as children to the block node. However, this is done by a script running in the editor so they do not appear in the scene. I believe they would appear in the scene if I set the owner property, but then this is going to cause issues during loading and saving since Godot will create and manage a separate copy of them rather than letting me create them in the _ready method of the block node. I'd also rather not have the user manually changing and possibly deleting these nodes if they have direct access to them.

I can understand why you wouldn't like people to mess around generated meshes, however it looks like the only way to make Cyclops data bake'ble. Personally,can't quite see why setting the owner of a node is such a big deal, the coppies issue isn't clear for me.

P.S. also if LightmapGI Bake() function was exposed and could be called by plugins of even in-executable, it would be easier to make SDK which wouldn't need any sourse code of a game/project to make maps or anything else that might need baked lighting.

Thanks.

@blackears
Copy link
Owner

I'm thinking of adding a command that lets you convert your scene to a regular mesh, which could side set this issue. It might also be possible to rework the plugin so that it works with setting the owner, although I would expect this would have a lot of unintended sideeffects. I don't know how soon I can get to this - finding time to work on this has been tough the last few months.

@verypleasentusername
Copy link
Author

verypleasentusername commented Nov 9, 2023

I'm thinking of adding a command that lets you convert your scene to a regular mesh, which could side set this issue. It might also be possible to rework the plugin so that it works with setting the owner, although I would expect this would have a lot of unintended sideeffects. I don't know how soon I can get to this - finding time to work on this has been tough the last few months.

godot's default scene export function works great with cyclops, it even saves collision nodes. But it also saves the wireframe model of blocks in file, which you have to delete manually. Its an easy fix, just let user turn off the wireframe models to export and thats it.

P.S. it looks like ot also creates a copy of blocks? one collection of blocks in in BlockBodies and another is in NODE ####.

@Calinou
Copy link
Contributor

Calinou commented Mar 26, 2024

Note that exporting to the Godot mesh format has been implemented as of 1.0.2, so you can do that then bake lightmaps afterwards. Converting to mesh is a destructive operation, so you'll want to keep a copy of your source CyclopsBlocks around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants