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

Discussion about custom hills.
Post Reply
sneze2r
Posts: 58
Joined: 17 Feb 2020, 12:56

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

Post 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
Jussi Koskela
Site Admin
Site Admin
Posts: 3657
Joined: 22 Jan 2007, 14:42
Location: Finland
Contact:

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

Post 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>
sneze2r
Posts: 58
Joined: 17 Feb 2020, 12:56

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

Post 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...
Xinitiao
Posts: 380
Joined: 05 Nov 2020, 22:49

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

Post 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!
Lurker since 2001
Better player than Garrean (for around 25 minutes at a time until he tries harder)
Men6ix_
Posts: 8
Joined: 21 May 2020, 19:22

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

Post 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.
sneze2r
Posts: 58
Joined: 17 Feb 2020, 12:56

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

Post 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
Jussi Koskela
Site Admin
Site Admin
Posts: 3657
Joined: 22 Jan 2007, 14:42
Location: Finland
Contact:

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

Post 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
Post Reply