Page 1 of 1

3d custom models(.obj ,.fbx...) in XML in form of pillars

Posted: 04 Dec 2020, 01:10
by sneze2r
Hello,

Has anyone managed to import 3d model into xml? Like in form of pillars for example. I believe proof of concept would be:

1. Decimate object in blender with triangulate option(in forms of connected triangles, pic rel), low poly 3d. Export to .obj file.
2. Every triangle can be presented in xml as max. 2 pillars, since we have x1 and x2 required parameters for pillars.
3. Create a wrapper that from .obj file creates pillars for the whole model. It would process each triangle as max 2 pillars.

I don't want to re-invent the wheel if it exists...

Image

Re: 3d custom models(.obj ,.fbx...) in XML in form of pillar

Posted: 04 Dec 2020, 10:50
by Jussi Koskela
No need to use pillars for that. <3dmodel> directive would be more appropriate. It's probably not yet documented at dsj4.pl
It looks like this:

Code: Select all

<hill ...>
	<3dmodel id="vdf134-roof">
		<batch id="roof" texture1="Textures\concrete5.png" material="Materials\material1.xml" fvf="322" order="0">
			<vertex id="1" x="-3" y="0" z="-3" u1="-3" v1="-3" diffuse="0xff747681"/>
			<vertex id="2" x="-3" y="0" z="3" u1="-3" v1="3" diffuse="0xff747681"/>
			<vertex id="3" x="0" y="2.5" z="0" u1="0" v1="0" diffuse="0xff747681"/>
			
			<vertex id="4" x="3" y="0" z="3" u1="3" v1="3" diffuse="0xff747681"/>
			<vertex id="5" x="3" y="0" z="-3" u1="3" v1="-3" diffuse="0xff747681"/>
			<vertex id="6" x="0" y="2.5" z="0" u1="0" v1="0" diffuse="0xff747681"/>

			<vertex id="7" x="-3" y="0" z="3" u1="-3" v1="3" diffuse="0xff747681"/>
			<vertex id="8" x="3" y="0" z="3" u1="3" v1="3" diffuse="0xff747681"/>
			<vertex id="9" x="0" y="2.5" z="0" u1="0" v1="0" diffuse="0xff747681"/>

			<vertex id="10" x="3" y="0" z="-3" u1="3" v1="-3" diffuse="0xff747681"/>
			<vertex id="11" x="-3" y="0" z="-3" u1="-3" v1="-3" diffuse="0xff747681"/>
			<vertex id="12" x="0" y="2.5" z="0" u1="0" v1="0" diffuse="0xff747681"/>
			
			<face v1="1" v2="2" v3="3"/>
			<face v1="4" v2="5" v3="6"/>
			<face v1="7" v2="8" v3="9"/>
			<face v1="10" v2="11" v3="12"/>
		</batch>
	</3dmodel>
	<3dmodel-instance id="vdf134-roof" refx="inrun0" refy="inrun-top" x="3.525" y="2.85" z="1.175"/>
</hill>
Additionally you can define extra "seams" between vertices to smoothen the surface in normals calculation.

Code: Select all

<hill ...>
	<3dmodel id="example">
		<batch id="1" ... >
			<vertex id="1" x="-3" y="0" z="-3" u1="-3" v1="-3" diffuse="0xff747681"/>
			<vertex id="2" x="-3" y="0" z="3" u1="-3" v1="3" diffuse="0xff747681"/>
		</batch>
		<batch id="2" ... >
			<vertex id="1" .../>
			<vertex id="2" ..."/>
		</batch>
		<seam b1="1" v1="1" b2="2" v2="1"/>
		<seam b1="1" v1="2" b2="2" v2="2"/>
	</3dmodel>
</hill>

Re: 3d custom models(.obj ,.fbx...) in XML in form of pillar

Posted: 04 Dec 2020, 13:22
by sneze2r
It's alive :D

Image

Although, I just finished this by using python converter for triangulated obj model to pillars. I'll try with 3dmodel since it's very similar format to .obj file.

I see that in dsj24 hills this 3dmodel method wasn't used in any hill(it is present in zakopane hs140 xml, but it's commented out). I'm not sure if someone from gorisek will create documentation for this...

Re: 3d custom models(.obj ,.fbx...) in XML in form of pillar

Posted: 04 Dec 2020, 13:28
by Xinitiao
:shock: Wow, the things that will be possible with this... Don't worry sneze2r, documentation for this will be created sooner or later for sure!

Re: 3d custom models(.obj ,.fbx...) in XML in form of pillar

Posted: 04 Dec 2020, 13:42
by Men6ix_
sneze2r wrote:It's alive :D

Image

Although, I just finished this by using python converter for triangulated obj model to pillars. I'll try with 3dmodel since it's very similar format to .obj file.

I see that in dsj24 hills this 3dmodel method wasn't used in any hill(it is present in zakopane hs140 xml, but it's commented out). I'm not sure if someone from gorisek will create documentation for this...
I will try, not sure whether every attribute should be described or just tutorial how to import these models with small explanation.

Re: 3d custom models(.obj ,.fbx...) in XML in form of pillar

Posted: 04 Dec 2020, 13:46
by sneze2r
Xinitiao wrote::shock: Wow, the things that will be possible with this... Don't worry sneze2r, documentation for this will be created sooner or later for sure!
Perfect :) for now I think I've got everything. I'll play around

Re: 3d custom models(.obj ,.fbx...) in XML in form of pillar

Posted: 04 Dec 2020, 18:45
by Jussi Koskela
Here are the available attributes. I'll fill more info during the weekend.
3dmodel
    Parent element: hill
    id
    refx
    refy
    refz
    refbone

batch
    Parent element: 3dmodel
    id
    fvf
    texture1
    material
    order
    zbias
    alphatest
    blending
    culling
    multitexturemode
    blendmode
    zwrite
    b1
    b2
    b3
    b4
    staticlighting
    mipmaplodbias
    refx
    refy
    refz
    refbone
    
vertex
    Parent element: batch
    x
    y
    z
    rhw
    w1
    w2
    w3
    nx
    ny
    nz
    psize
    diffuse
    diffuse2
    u1
    v1
    u2
    v2
    b1
    b2
    b3
    b4
    
face
    Parent element: batch
    v1
    v2
    v3
    
seam
    Parent element: 3dmodel
    b1
    b2
    v1
    v2
    
3dmodel-instance
    Parent element: hill