Page 19 of 74

Re: [WIP] Grimrock Model Tookit

Posted: Sat Oct 06, 2012 3:04 pm
by Bek
I was curious about the application of the real vertex count of a model, so I asked on the polycount forums and a member there was kind enough to explain various situations to me, and he also gave a method for calculating a mesh's efficiency on a scale of >0 to 3, lower being more efficient, with 3 being worst possible scenario, 2 being worst case 'practical' scenario for a continuous mesh, and under 1 being a good goal to aim for.

So since this is a simple calculation (Real vert count / number of triangles) = efficiency rating, it might be a feature you could implement into the GMT? Of course the scale would have to be explained, but users might find it useful to know the efficiency of their models. Credit for this info to perna from polycount, full details here. Not a vital feature, but it may help modellers keep their stuff efficient (or at least alert them to this stuff if they're unaware).

Re: [WIP] Grimrock Model Tookit

Posted: Sat Oct 06, 2012 4:04 pm
by JohnWordsworth
@Juppstein: I've had a look at your ladder floor model and have found that the following export options from Blender will allow you to generate a mesh with a single MeshNode but with multiple Segments. When I load in your ladder / floor model with the following settings I get a model with 1 object but 8 segments, where you can assign a material to each segment individually.

Blender OBJ Export Settings (some of the defaults were still on, I'm pretty sure these are the important ones):

Apply Modifiers: ON
Include Normals: ON
Include UVs: ON
Triangulate Faces: ON (Blender will do this better than I do!)
Objects as OBJ Objects: OFF
Objects as OBJ Groups: ON

I currently use the OBJ groups to describe the different mesh segments.

@Neikun: Glad you got it working ok :).
@Bek: That's a good idea, I'll add it to the list (but I'm afraid it's probably quite low priority, as I'm chasing bugs at the moment!).

Re: [WIP] Grimrock Model Tookit

Posted: Sat Oct 06, 2012 10:19 pm
by Leki
Hi John, v0.1.0.11 when I export model to obj, and then import the same model I cannot see it. Data View is ok, but i cannot see visual. I cannot save this obj as model - actually I can, but I cannot see it ingame. Model is there, but "invisiblle". btw - if you import model, you can see "log info": No File Loaded" - but i can see obj, data file in Data View...

Re: [WIP] Grimrock Model Tookit

Posted: Sat Oct 06, 2012 10:45 pm
by JohnWordsworth
Hi Leki, just out of interest - which model are you testing with? Some objects in the grimrock model format are stored as massive objects along with a transform matrix which 'shrinks it down' to game size. Unfortunately, when you export to .OBJ and then re-import, this transform matrix is lost. It could just be that the imported model is massive and the camera is inside of it. In this case, you can turn off 'Backface Culling' in the render menu and/or turn on Wireframe mode to see if you can see the model.

At the moment, to resolve this issue - you are advised to write down the "Node Transform Matrix" from the "Tools -> Edit Node Transform Dialog" and then re-enter it for the re-imported model. You could obviously also down-scale the model in Blender to a reasonable size (a 'square' in Grimrock is 3x3).

Re: [WIP] Grimrock Model Tookit

Posted: Sat Oct 06, 2012 11:21 pm
by Leki
it's "dungeon_door_secret". Of course I tried wireframe, camera move etc - with no result - when I import obj to blender - it was 300x300 - I resize it to 3x3 (scale /100), but after import into Toolkit, it's the same again - i cannot see object in viewport, but the object is "there". Reimort of this obj to blender shows him in size of 3x3. I created basic cube 2x2x2 in blender and exported it to obj - in Toolkit it showed the same issue. This bug i got in 0.1.0.11. but maybe the problem is in my computer, but I have no idea where. I used 0.1.0.10 on my notebook and created a model of secret door - then it worked (some nodes, for example "door" was missed etc, because doors and known bug with nodes - but model was there. New model like skybox as well. When I came home to my desktop and started editor, object was invisible. I have Ati card in desktop and nVidia in notebook, but that's no mater i guess, because renderer of Grimrock is working without issues. Also I got error with 0.1.0.11 after installing - models without textures - I reinstaled MS .Net framework 4.0 and models are ok atm.

Edit: I tested scene on my small notebook with intel 4500... it's working. fresh install of your toolkit and fresh install of .Net framework 4.0 - I can see models in editor and in the toolkit :o

Edit 2: hmm. on my small notbook (its HP Pavilion dm1) I can see model in editor (in game too) but when I use mouselook, in some angles the model disapears (i can see "hole"). Maybe its part on nodes bug or origin/pivot of model, dunno atm.

Re: [WIP] Grimrock Model Tookit

Posted: Sun Oct 07, 2012 12:11 am
by JohnWordsworth
Release Notice: Grimrock Model Toolkit v0.1.0.12. Changes include...

Fix: Renderer now uses the correct handedness, which was causing imported models to be reflected in the x-axis. Many thanks to @Isaac: I wouldn't have noticed for ages otherwise!
Feature: Added a 3x3 grid with a 1x1 sub-grid which you can turn on/off.
Fix: Bounding Box Min/Max is now correctly calculated for imported meshes.
Update: Imported nodes from OBJ files now set castShadows to true by default instead of false.

@Phitt, I'm afraid this doesn't seem to rectify your problem yet. I've imported my own wallsets for testing purposes (from blender) and also go weird problems (although my random extra polygons only appeared in game, and not in the editor!). I get the impression that there's something just slightly wrong with the files I'm importing and it only shows with the wall geometry (I get the impression that geometry is probably loaded differently to other geometry, as you cannot destroy it in game).

@Leki, will keep my eye on this. If these strange things are happening in game, you might be suffering from the same thing as @Phitt, there appears to be something wrong with the model files for use as wall-sets, but we can't figure out what! :(

We'll fix it, it's just taking some time I'm afraid.

Edit: A download link would be useful wouldn't it!? GMT Homepage, Direct Download (2Mb).

Edit 2: I wonder if something weird is going on, like all walls must have a normal map and thus tangent/bi-tangent vertices (which I don't support yet).

Re: [WIP] Grimrock Model Tookit

Posted: Sun Oct 07, 2012 12:47 am
by Leki
Well - I examined my old model created on my desktop and it's corupted in my notebook (it was hapen on Fryday) - in blender invisible face appears in editor in some angles - from one edge of cube there was face with vertex in object pivot...
After some time walking aroun i got crash of game (on my notebook with nVidia - its powerfull worstation btw i7 on board, 8GB ram etc...).
I tested 0.1.0.12 this way: start toolkit, open model altar, its ok - textures and mesh, export as obj, import altar.obj - nothing. check obj inblender - its 100x bigger. Save obj as model in toolkit, open model in toolkit - nothing. Zoom out as hell, wireframe, backfacing etc, rotating... ingame - object is there (no script errors etc) - but invisible. I guess there is bug in "export/import obj". It's not wall conected issue - i defined my object as a Decoration, blocker etc. Hmm... It was only cube (cube as box and cube as skybox - size 12x12 - 4x4x squares and secon 1x1 / 1/3 of square with pivot in center of cube etc). again, modela are working on my intel 4500 (i dont have here my workstation notebook), but its bugged on my AMD Rageaon 6970. Maybe is there also bug in your renderer, when you rewrite it from openGL into Dirext3D? And John, sorry for my English - I hope you can survive it :-)

Edit: I hava something!
I zoomed out once more - as "doble hell" :-) on resaved altar model and toolkit screen flashed and crashed

Edit2 : After that i god idea. I opened altar.obj in blender again. It was 3x3 size - I mean 1,5-2,3 or something as that - normal altar size. I rescaled this obj *0,01 - whih means scal was now 0.00001x original imported model from Toolkit (which was 100x bigger). Then I reopened altar in Toolkid. Nothing... hmm - but wait! there is a dot in the centre of the grid! - Zoom IN - and - altar is there :-)
I changed scale in blender into 0.0001 - it's bigger now, hmm
then scale of object to 0.001 - it's ok!

So there is only some bug with scaling?

Edit: I did test with another model - dungeon_secret_door
No way :oops:
I still can import altar, but I have no chance to show secret door model in Toolkit - tried scaling from 100 - 0.00001
Edit: floor gaves the same result and I cannot repeat the altar sclaling trick :?

Recomandation - can you add shortcut key or menu - fit (zoom to see) model in viewport?

Edit: Not only scaling. There is something bad with pivot i guess. I used objviewer (http://www.pyramidproject.net/objviewer.php) to check obj file. It can open all obj (exept ogre which is bugget in blender as well). I tested another one obj viewer - 3D modelviewer. Based on that I mean that there is bug in obj model loading. I think that you can read part of file with info, but there is problem with renderer. Vertex are colapsed in one point of something like that. I am not a programmer - I have only some bassic experience with that - I found this page - maybe it can help you to fing the bug http://www.limegarden.net/2010/03/02/wa ... sh-loader/, or check [url]C:\Program Files\Microsoft DirectX SDK (November 2008)\Samples\C++\Direct3D10\MeshFromOBJ10[/url]...

Re: [WIP] Grimrock Model Tookit

Posted: Sun Oct 07, 2012 1:10 am
by Isaac
JohnWordsworth wrote:Fix: Renderer now uses the correct handedness, which was causing imported models to be reflected in the x-axis. Many thanks to @Isaac: I wouldn't have noticed for ages otherwise!
Image

Version 0.1.12 installs and works fine for me. Image

** I have a few very low priority suggestions for your next build.

First, since many custom models will probably have the same ~or nearly the same name as the imported model file, would it make sense to add the loaded model name as the default save name in the export dialog?

Secondly, the Material replace dialog is re-sizable

The Third is marginal niche... Blender exports the materials with the material name and the name file name appended to it; This means that every exported model needs the materials replaced; because each material has three images; [Diffuse/Normal/Specular].
Image
Now if the toolkit were to truncate the existing material name (which is conveniently delimited by an underscore ;) ) it would mean that the user could name the materials in Blender; define them in the LUA (same names), and the exported models would have the Grimrock Custom Texture names as their materials, instead of having them mangled with the appended (and useless) image filenames. Perhaps their could be a checkbox that enables Blender specific material handling?
* Obviously we shouldn't name our materials with an underscore if this option gets implemented. It'd be really ~really cool though.
(I must have exported and fixed the materials by hand about 28 times last night on just one model file.)

Lastly... The app crashes on load if it is the second instance of the app; meaning, with the toolkit loaded... running another instance of the application causes a hard crash in the 2nd app ~but causes no problems for the first.

Re: [WIP] Grimrock Model Tookit

Posted: Sun Oct 07, 2012 3:17 am
by JohnWordsworth
First of all, a really quick update release of version 0.1.0.13 is now available. GMT HomePage Direct Download. Fixes an issue where Texture UVs were being flipped twice (so weren't being flipped) on OBJ Export. So the 'round trip' wasn't successful as the texture was wrong.

@Leki: No worries about the Engligh, you're making a lot more sense than a lot of people I have talked with in the past (and English is their native language!). That's strange that it's buggy on your AMD card - but unfortunately, both of my PCs here are NVidia, so I have no AMD card to test on. I'm just uploading a video of how I do my 'roundtrip' tests on my models (will link to it in 10 mins). Could you please let me know if you get the same results as I do if you follow the video exactly? It explains the 'Node Transform Matrix' issue and remapping the original materials on an imported model.

Note: Video will exist at http://www.johnwordsworth.com/downloads ... xample.mp4 when the upload has finished. I'm afraid it's just an MP4 so you might need VLC to play it if it doesn't just play in your browser. Thanks for persevering @Leki and for working with me to get through the bugs.

@Isaac: That's great news that it now works! I expect SlimDX has finally given in and started working for you. I'll add your suggestions to The To Do List. Thanks also for the bug reports, I'll also add them to the list. The resizable window is an easy one, I guess the second one is probably something to do with trying to initialise another DirectX device perhaps - I'll check that out too. Thanks for the feedback :).

Re: [WIP] Grimrock Model Tookit

Posted: Sun Oct 07, 2012 3:35 am
by Leki
Dont worry, i have VLC, chrome and stuff for watching mp4 in browser.
Thanks for v.13 - I already find the bug with UVs, so there is not a reason to post it.
I tried again to recreate altar - and it works - but dragon statue for example not - i will try to ivestigate further

Edit:
dungeon_secret_door_load_model:

Code: Select all

Name: gate 
LocalToParent: [(0,01, 0, 0), (0, 0,01, 0), (0, 0, 0,01), (0, 0, 0)] 
Parent: 0 
Type: 0

Mesh Entity
Bone Count: 0 
Emissive Color: (0, 0, 0) 
Cast Shadow: True 

Mesh Data
Vertex Count: 800 
Index Count: 1290 
Segment Count: 1 
Bound Center: (0, 150, 0) 
Bound Min: (-150, -1,714505E-14, -10) 
Bound Max: (150, 300, 10) 
Bound Radius: 212,3676
Vertex Arrays: 
 0: 3, 3, 12, 9600
 1: 3, 3, 12, 9600
 2: 3, 3, 12, 9600
 3: 3, 3, 12, 9600
 4: 0, 0, 0, 0
 5: 3, 2, 8, 6400
 6: 0, 0, 0, 0
 7: 0, 0, 0, 0
 8: 0, 0, 0, 0
 9: 0, 0, 0, 0
 10: 0, 0, 0, 0
 11: 0, 0, 0, 0
 12: 0, 0, 0, 0
 13: 0, 0, 0, 0
 14: 0, 0, 0, 0

0 Invalid Indices
//------------------------------------------------------------

dungeou_secret_door after import:

Code: Select all

Name: MainObject 
LocalToParent: [(1, 0, 0), (0, 1, 0), (0, 0, 1), (0, 0, 0)] 
Parent: 0 
Type: 0

Mesh Entity
Bone Count: 0 
Emissive Color: (0, 0, 0) 
Cast Shadow: True 

Mesh Data
Vertex Count: 800 
Index Count: 1290 
Segment Count: 1 
Bound Center: (0, 150, 0) 
Bound Min: (-150, 0, -10) 
Bound Max: (150, 300, 10) 
Bound Radius: 150
Vertex Arrays: 
 0: 3, 3, 12, 9600
 1: 3, 3, 12, 9600
 2: 0, 0, 0, 0
 3: 0, 0, 0, 0
 4: 0, 0, 0, 0
 5: 3, 2, 8, 6400
 6: 0, 0, 0, 0
 7: 0, 0, 0, 0
 8: 0, 0, 0, 0
 9: 0, 0, 0, 0
 10: 0, 0, 0, 0
 11: 0, 0, 0, 0
 12: 0, 0, 0, 0
 13: 0, 0, 0, 0
 14: 0, 0, 0, 0

0 Invalid Indices
//------------------------------------------------------------

ignore transform matrix that's known issue
check Vertex arrays line 2 ,3!
exported obj must be ok, because I can open it in many obj viewers. Bug is in import obj I guess.

Details about obj: http://www.martinreddy.net/gfx/3d/OBJ.spec
If import is buged, maybe you can try to implement this? http://assimp.sourceforge.net/main_feat ... rmats.html