Blender 2.71 - Importer / Exporter (1.4.4)

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
bitcpy
Posts: 39
Joined: Tue Apr 24, 2012 7:43 pm

Re: Blender 2.71 - Importer / Exporter

Post by bitcpy » Tue Dec 09, 2014 1:39 am

Updated the script to support custom generated normals.
Also updated so the exporter skips hidden objects during export, this should allow you to be able to place your hi-poly, exploded mesh and game ready low-poly inside the same scene so you can bake and export from a single work file (I hope).

(I haven't given Sculptris workflow much thought if anyone is using that or other hi-poly modeling tool such as ZBrush, 3DCoat, MudBox etc)

Latest Version 1.4.3
https://sites.google.com/site/bitcpy/do ... sion-1.4.3

So I decided to give ground foliage a shot or other planes that you would like to smooth out normals on (trees I guess).
I know there are some external Blender tools for this, way better than this approach.
What I wanted was a simple solution to at least allow people to get decent working ground foliage, so I added some custom data that you can hook up with your mesh.
It's located on the mesh data tab in Blender (look for 'Legend of Grimrock' section similar to the one in the Tools Panel)
What you need to do is create a vertex group and assign vertices that you want custom normals for.
Then create an empty object and place it somewhere in the scene.
Now select the vertex group and empty object from the 'Vertex Group' and 'Normal Center' properties in the 'Legend of Grimrock' panel.
Whenever you export this model the normals will be re-calculated for the vertices so that the normal points in the direction as if you would have drawn a straight line from the empty object to the vertex.
Just a side note here, this might screw up your normal map since some normals now point in a different direction compared to when it was baked.

Here's a picture of the setup in Blender
Image

A look at our new normals in GMT
Image

And finally comparing the 'real' plant to the left with our newly exported plant to the right in-game
Image

minmay
Posts: 2655
Joined: Mon Sep 23, 2013 2:24 am

Re: Blender 2.71 - Importer / Exporter

Post by minmay » Tue Dec 09, 2014 1:40 am

Awesome, thank you so much!
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.

bitcpy
Posts: 39
Joined: Tue Apr 24, 2012 7:43 pm

Re: Blender 2.71 - Importer / Exporter

Post by bitcpy » Tue Dec 09, 2014 1:49 am

@germanny
Maybe, it would require a bit of cleanup and removal of questionable dat container digging code I guess.
I haven't looked into it, but maybe I'll do whenever I get around to do a cleanup pass on it.

bitcpy
Posts: 39
Joined: Tue Apr 24, 2012 7:43 pm

Re: Blender 2.71 - Importer / Exporter

Post by bitcpy » Tue Dec 09, 2014 1:50 am

@minmay
Crossing my fingers, hope it works! :)

Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Blender 2.71 - Importer / Exporter

Post by Batty » Tue Dec 09, 2014 2:20 am

bitcpy wrote:@germanny
Maybe, it would require a bit of cleanup and removal of questionable dat container digging code I guess.
I haven't looked into it, but maybe I'll do whenever I get around to do a cleanup pass on it.
After the asset pack is released you can get rid of the .dat digging code for good, it won't be needed, so maybe go official then.

User avatar
Thorham
Posts: 80
Joined: Sat May 04, 2013 5:12 pm

Re: Blender 2.71 - Importer / Exporter (1.4.3)

Post by Thorham » Mon Dec 15, 2014 6:45 am

Awesome bitcpy, thanks for making and releasing this.

Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Blender 2.71 - Importer / Exporter (1.4.3)

Post by Batty » Mon Dec 22, 2014 4:30 pm

Hello bitcpy, I always change the size of the game_matrix & RootNode arrows to 1 for various reasons but I'd like it done automatically. I changed the value in this line to 1:

Code: Select all

2681 game_matrix_ob.empty_draw_size = 1
so the game_matrix is automatically at my preferred size when importing. I want to change the RootNode also but without changing all the other nodes as well (not good for things with armatures).
I see that it's line 2704 in this block:

Code: Select all

2703 node_ob.empty_draw_type = 'ARROWS'
2704 node_ob.empty_draw_size = 0.25
2705 node_ob.parent = parent_ob
2706 node_ob.matrix_world = node_transform
Is there a simple if statement or few lines of script that could change only the RootNode arrow size and leave all other nodes as is? Thanks, very minor thing so feel free to ignore. :)

bitcpy
Posts: 39
Joined: Tue Apr 24, 2012 7:43 pm

Re: Blender 2.71 - Importer / Exporter (1.4.3)

Post by bitcpy » Mon Dec 22, 2014 6:32 pm

Yes, you could test for the RootNode and set it to 1, otherwise leave it at 0.25.

A quick example of how you could do this.

Code: Select all

node_ob.empty_draw_type = 'ARROWS'
if node.name == 'RootNode':
    node_ob.empty_draw_size = 1.0
else:
    node_ob.empty_draw_size = 0.25
node_ob.parent = parent_ob
node_ob.matrix_world = node_transform
Make sure you get the indentation right or the script might break.
Don't use tabs, and indent blocks with 4 spaces.

Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Blender 2.71 - Importer / Exporter (1.4.3)

Post by Batty » Mon Dec 22, 2014 8:15 pm

Excellent, thanks, made the change and working as I wanted. :)

sajon
Posts: 38
Joined: Fri Nov 08, 2013 7:17 am

Re: Blender 2.71 - Importer / Exporter (1.4.3)

Post by sajon » Thu Jan 15, 2015 12:15 am

Problem trying to create just a simple sphere or cone! Can anyone tell me what i am doing wrong?

I get the following error when i try to Export using Blender 2.72 with exporter 1.4.3
It only errors when I add a cone or sphere mesh and try to export. I have tried all other meshes...??

Image:
Image

Thanks
Last edited by sajon on Thu Jan 15, 2015 12:44 am, edited 1 time in total.

Post Reply