Tree Scene Node v2.1

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

No, that is not XML reading problem. I tested this. When tried precompiled example it always crashes.
I recompiled your source and result was the same. Then after debugging of sources found the problem points.

With these additions that I wrote above project works.
That is invoking of zero pointer problem for me. Sorry if I perplex you with my bad English.
ImageImage
Site development -Rock and metal online
--- etcaptor.com ------freenetlife.com
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

OK, I just adapted shogun's plugin for your trees to VisualEditor.
http://irrlicht.sourceforge.net/phpBB2/ ... 8&start=60
ImageImage
Site development -Rock and metal online
--- etcaptor.com ------freenetlife.com
doqkhanh
Posts: 158
Joined: Sat Mar 01, 2008 3:14 am
Location: Tokyo, Japan
Contact:

Post by doqkhanh »

:shock: Very very usefull, thanks very much!
doqkhanh
Posts: 158
Joined: Sat Mar 01, 2008 3:14 am
Location: Tokyo, Japan
Contact:

Cound not load .irr file with tree

Post by doqkhanh »

:D Hi,
I created a .irr map with irrEdit, used treenode plug-in and saved as this map as tree.irr

Code: Select all

smgr->loadScene("Data\\tree.irr")
I also included

Code: Select all

#include "CTreeGenerator.h"
#include "CBillboardGroupSceneNode.h"
#include "CTreeSceneNode.h"
My demo Build OK !

When I run it, after load all mesh and texture, my demo crashed!

In console window:

Code: Select all

Could not create scene node of unknown type: klaskerTreeSceneNode_0
Loaded texture: c:\users\khanh\desktop\trees\proceduraltrees\textures\oakleaf.pn
g
[/code]
shogun
Posts: 162
Joined: Wed Sep 05, 2007 11:02 am
Location: inside

Post by shogun »

Did you register the factory?

You have to execute this code before loading your scene:

Code: Select all

CKlaskerTreeSceneNodeFactory* factory = new CKlaskerTreeSceneNodeFactory(yourScenemanager, yourIrrlichtDevice);
yourScenemanager->registerSceneNodeFactory(factory);
factory->drop();
doqkhanh
Posts: 158
Joined: Sat Mar 01, 2008 3:14 am
Location: Tokyo, Japan
Contact:

Post by doqkhanh »

:( Anyone has HLSL for leafnode?
Please help me !
TCNJ
Posts: 9
Joined: Sun Mar 30, 2008 3:27 pm

Texture linking with Irredit plugin

Post by TCNJ »

I'm trying to utilize these tree nodes using the irredit plugin, I can get the tree to load ok but am unable to figure out how to link the textures so the tree is black and the leaves are green from the shader. Any help would be greatly appreciated.

Michael Dillon
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

It's possible. I wrote my tree scene node for irredit around six months ago so I'll have to dig out the source and check how I handled textures.
Image
shogun
Posts: 162
Joined: Wed Sep 05, 2007 11:02 am
Location: inside

Post by shogun »

TCNJ wrote:I'm trying to utilize these tree nodes using the irredit plugin, I can get the tree to load ok but am unable to figure out how to link the textures so the tree is black and the leaves are green from the shader. Any help would be greatly appreciated.
Did you change the textures in the Materials tab of the tree scenenode? The first texture is the bark, the second is the texture for the LOD far away and the third texture is for the leaves (if existing).
TCNJ
Posts: 9
Joined: Sun Mar 30, 2008 3:27 pm

Post by TCNJ »

I did try changing the textures there, but for me the only texture that changes is the leaves. I'm using Irredit 1.4 Alpha but I also tried it in 0.7.1 with the same results.

EDIT: It appears that the first texture is being applied to the leaves and also being used for the LOD.
shogun
Posts: 162
Joined: Wed Sep 05, 2007 11:02 am
Location: inside

Post by shogun »

That's strange, I never had problems with the material. Could you upload a test scene and your tree-file?
TCNJ
Posts: 9
Joined: Sun Mar 30, 2008 3:27 pm

Post by TCNJ »

Here is the portion of the scene with the tree node.

Code: Select all

<node type="klaskerTreeSceneNode_0">

		<attributes>
			<string name="Name" value="" />
			<int name="Id" value="-1" />
			<vector3d name="Position" value="1472.615479, -45.102962, 440.503357" />
			<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
			<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
			<bool name="Visible" value="true" />
			<enum name="AutomaticCulling" value="box" />
			<int name="DebugDataVisible" value="0" />
			<bool name="IsDebugObject" value="false" />
			<int name="Seed" value="0" />
			<vector3d name="LightDir" value="-0.577350, -0.577350, -0.577350" />
		</attributes>

		<materials>
			<attributes>
				<enum name="Type" value="solid" />
				<color name="Ambient" value="ffffffff" />
				<color name="Diffuse" value="ffffffff" />
				<color name="Emissive" value="00000000" />
				<color name="Specular" value="ffffffff" />
				<float name="Shininess" value="0.000000" />
				<float name="Param1" value="0.000000" />
				<float name="Param2" value="0.000000" />
				<texture name="Texture1" value="materials/AspenBark.png" />
				<texture name="Texture2" value="materials/AspenBillBoard.png" />
				<texture name="Texture3" value="materials/AspenLeaf.png" />
				<texture name="Texture4" value="" />
				<bool name="Wireframe" value="false" />
				<bool name="GouraudShading" value="true" />
				<bool name="Lighting" value="true" />
				<bool name="ZWriteEnable" value="true" />
				<int name="ZBuffer" value="1" />
				<bool name="BackfaceCulling" value="true" />
				<bool name="FogEnable" value="false" />
				<bool name="NormalizeNormals" value="false" />
				<bool name="BilinearFilter1" value="true" />
				<bool name="BilinearFilter2" value="true" />
				<bool name="BilinearFilter3" value="true" />
				<bool name="BilinearFilter4" value="true" />
				<bool name="TrilinearFilter1" value="false" />
				<bool name="TrilinearFilter2" value="false" />
				<bool name="TrilinearFilter3" value="false" />
				<bool name="TrilinearFilter4" value="false" />
				<bool name="AnisotropicFilter1" value="false" />
				<bool name="AnisotropicFilter2" value="false" />
				<bool name="AnisotropicFilter3" value="false" />
				<bool name="AnisotropicFilter4" value="false" />
				<enum name="TextureWrap1" value="texture_clamp_repeat" />
				<enum name="TextureWrap2" value="texture_clamp_repeat" />
				<enum name="TextureWrap3" value="texture_clamp_repeat" />
				<enum name="TextureWrap4" value="texture_clamp_repeat" />
			</attributes>
			<attributes>
				<enum name="Type" value="trans_alphach" />
				<color name="Ambient" value="ffffffff" />
				<color name="Diffuse" value="ffffffff" />
				<color name="Emissive" value="00000000" />
				<color name="Specular" value="ffffffff" />
				<float name="Shininess" value="0.000000" />
				<float name="Param1" value="0.000000" />
				<float name="Param2" value="0.000000" />
				<texture name="Texture1" value="materials/AspenBark.png" />
				<texture name="Texture2" value="materials/AspenBillBoard.png" />
				<texture name="Texture3" value="materials/AspenLeaf.png" />
				<texture name="Texture4" value="" />
				<bool name="Wireframe" value="false" />
				<bool name="GouraudShading" value="true" />
				<bool name="Lighting" value="false" />
				<bool name="ZWriteEnable" value="true" />
				<int name="ZBuffer" value="1" />
				<bool name="BackfaceCulling" value="true" />
				<bool name="FogEnable" value="false" />
				<bool name="NormalizeNormals" value="false" />
				<bool name="BilinearFilter1" value="true" />
				<bool name="BilinearFilter2" value="true" />
				<bool name="BilinearFilter3" value="true" />
				<bool name="BilinearFilter4" value="true" />
				<bool name="TrilinearFilter1" value="false" />
				<bool name="TrilinearFilter2" value="false" />
				<bool name="TrilinearFilter3" value="false" />
				<bool name="TrilinearFilter4" value="false" />
				<bool name="AnisotropicFilter1" value="false" />
				<bool name="AnisotropicFilter2" value="false" />
				<bool name="AnisotropicFilter3" value="false" />
				<bool name="AnisotropicFilter4" value="false" />
				<enum name="TextureWrap1" value="texture_clamp_repeat" />
				<enum name="TextureWrap2" value="texture_clamp_repeat" />
				<enum name="TextureWrap3" value="texture_clamp_repeat" />
				<enum name="TextureWrap4" value="texture_clamp_repeat" />
			</attributes>
			<attributes>
				<enum name="Type" value="trans_alphach_ref" />
				<color name="Ambient" value="ffffffff" />
				<color name="Diffuse" value="ffffffff" />
				<color name="Emissive" value="00000000" />
				<color name="Specular" value="ffffffff" />
				<float name="Shininess" value="0.000000" />
				<float name="Param1" value="0.000000" />
				<float name="Param2" value="0.000000" />
				<texture name="Texture1" value="materials/AspenBark.png" />
				<texture name="Texture2" value="materials/AspenBillBoard.png" />
				<texture name="Texture3" value="materials/AspenLeaf.png" />
				<texture name="Texture4" value="" />
				<bool name="Wireframe" value="false" />
				<bool name="GouraudShading" value="true" />
				<bool name="Lighting" value="false" />
				<bool name="ZWriteEnable" value="true" />
				<int name="ZBuffer" value="1" />
				<bool name="BackfaceCulling" value="true" />
				<bool name="FogEnable" value="false" />
				<bool name="NormalizeNormals" value="false" />
				<bool name="BilinearFilter1" value="false" />
				<bool name="BilinearFilter2" value="false" />
				<bool name="BilinearFilter3" value="false" />
				<bool name="BilinearFilter4" value="false" />
				<bool name="TrilinearFilter1" value="false" />
				<bool name="TrilinearFilter2" value="false" />
				<bool name="TrilinearFilter3" value="false" />
				<bool name="TrilinearFilter4" value="false" />
				<bool name="AnisotropicFilter1" value="true" />
				<bool name="AnisotropicFilter2" value="true" />
				<bool name="AnisotropicFilter3" value="true" />
				<bool name="AnisotropicFilter4" value="true" />
				<enum name="TextureWrap1" value="texture_clamp_repeat" />
				<enum name="TextureWrap2" value="texture_clamp_repeat" />
				<enum name="TextureWrap3" value="texture_clamp_repeat" />
				<enum name="TextureWrap4" value="texture_clamp_repeat" />
			</attributes>
		</materials>
		<node type="">

			<attributes>
				<string name="Name" value="" />
				<int name="Id" value="-1" />
				<vector3d name="Position" value="0.000000, 0.000000, 0.000000" />
				<vector3d name="Rotation" value="0.000000, 0.000000, 0.000000" />
				<vector3d name="Scale" value="1.000000, 1.000000, 1.000000" />
				<bool name="Visible" value="true" />
				<enum name="AutomaticCulling" value="box" />
				<int name="DebugDataVisible" value="0" />
				<bool name="IsDebugObject" value="false" />
			</attributes>

			<materials>
				<attributes>
					<enum name="Type" value="trans_alphach_ref" />
					<color name="Ambient" value="ffffffff" />
					<color name="Diffuse" value="ffffffff" />
					<color name="Emissive" value="00000000" />
					<color name="Specular" value="ffffffff" />
					<float name="Shininess" value="0.000000" />
					<float name="Param1" value="0.000000" />
					<float name="Param2" value="0.000000" />
					<texture name="Texture1" value="materials/tree.png" />
					<texture name="Texture2" value="" />
					<texture name="Texture3" value="" />
					<texture name="Texture4" value="" />
					<bool name="Wireframe" value="false" />
					<bool name="GouraudShading" value="true" />
					<bool name="Lighting" value="false" />
					<bool name="ZWriteEnable" value="true" />
					<int name="ZBuffer" value="1" />
					<bool name="BackfaceCulling" value="true" />
					<bool name="FogEnable" value="false" />
					<bool name="NormalizeNormals" value="false" />
					<bool name="BilinearFilter1" value="false" />
					<bool name="BilinearFilter2" value="false" />
					<bool name="BilinearFilter3" value="false" />
					<bool name="BilinearFilter4" value="false" />
					<bool name="TrilinearFilter1" value="false" />
					<bool name="TrilinearFilter2" value="false" />
					<bool name="TrilinearFilter3" value="false" />
					<bool name="TrilinearFilter4" value="false" />
					<bool name="AnisotropicFilter1" value="true" />
					<bool name="AnisotropicFilter2" value="true" />
					<bool name="AnisotropicFilter3" value="true" />
					<bool name="AnisotropicFilter4" value="true" />
					<enum name="TextureWrap1" value="texture_clamp_repeat" />
					<enum name="TextureWrap2" value="texture_clamp_repeat" />
					<enum name="TextureWrap3" value="texture_clamp_repeat" />
					<enum name="TextureWrap4" value="texture_clamp_repeat" />
				</attributes>
			</materials>
		</node>
</node>
Here is the tree.

Code: Select all

- <tree>
- <branch id="1">
  <length min="160" max="200" /> 
  <radius value="22" /> 
  <radiusEnd value="0.60" /> 
- <child ref="2">
  <position min="0" max="1" /> 
  <orientation min="30" max="170" /> 
  <pitch min="30" max="110" /> 
  <count min="6" max="12" /> 
  </child>
- <child ref="1">
  <lengthScale value="0.606" /> 
  <position value="0.95" /> 
  <pitch min="0" max="5" /> 
  <count value="1" /> 
  </child>
  </branch>
- <branch id="2">
  <length value="100" /> 
  <radius value="10" /> 
  <radiusEnd value="0.50" /> 
- <leaf level="1">
  <position value="0.95" /> 
  <red min="210" max="255" /> 
  <green value="255" /> 
  <blue min="128" max="128" /> 
  <width value="40" /> 
  <height value="40" /> 
  </leaf>
- <leaf level="2">
  <position min="0" max="0.8" /> 
  <red min="210" max="255" /> 
  <green value="255" /> 
  <blue min="128" max="128" /> 
  <width value="40" /> 
  <height value="40" /> 
  </leaf>
- <child ref="2">
  <lengthScale value="0.7" /> 
  <position value="0.95" /> 
  <pitch min="0" max="35" /> 
  <count min="1" max="2" /> 
  </child>
  </branch>
- <branch id="3">
  <length min="70" max="120" /> 
  <radius value="22" /> 
  <radiusEnd value="0.60" /> 
- <child ref="1">
  <lengthScale value="0.606" /> 
  <position value="0.95" /> 
  <pitch min="0" max="5" /> 
  <count value="1" /> 
  </child>
  </branch>
  <root ref="3" levels="6" /> 
  </tree>
Thanks for all the help.

Michael Dillon
shogun
Posts: 162
Joined: Wed Sep 05, 2007 11:02 am
Location: inside

Post by shogun »

TCNJ wrote:

Code: Select all

<node type="klaskerTreeSceneNode_0">
				<texture name="Texture1" value="materials/AspenBark.png" />
				<texture name="Texture2" value="materials/AspenBillBoard.png" />
				<texture name="Texture3" value="materials/AspenLeaf.png" />
				<texture name="Texture4" value="" />
You seem to give one of the materials three textures. That's the mistake, you should make it so that the first material has the bark-texture (in slot 1), the second material has the LOD-texture (in slot 1, too, but not really needed) and the third material has the leaves-texture (if the tree even has leaves, of course).
TCNJ
Posts: 9
Joined: Sun Mar 30, 2008 3:27 pm

Thanks

Post by TCNJ »

Thank you, I had tried that but it didn't work for the bark, which I just realized was because for bark the lighting box was checked by default and I didn't notice it. Again thank you very much for your help.

Michael
m0rph
Posts: 1
Joined: Mon Apr 07, 2008 12:58 pm

Post by m0rph »

Hello,

I'm getting strange errors when using Procedural Trees with my IDE (MS VC++.NET 2008 Express). The sample project is running fine, but when I make a new project, add the Irrlicht.dll and the header and code data from the sample project, and COPY & PASTE the main.cpp's code into the new main.cpp, it doesn't work.

More precisely, I get a

Code: Select all

error LNK2019: unresolved external symbol ""class irr::IrrlichtDevice * __cdecl irr::createDevice([...])" ([...])" referenced in function "_main".
After fixing that by adding the

Code: Select all

#pragma comment(lib, "Irrlicht.lib")
statement, I get really strange errors like

Code: Select all

Unsolved exception at 0x00413026 in TreeTest2.exe: 0xC0000005: Access violation when reading at position 0x00000004.
(sorry for not-so-exact error text's, I'm using the german Visual Studio ;) )
and refers me to the "bool drop() const" function in the IReferenceCounted.h

I guess there is some kind of reference issue or something wrong in the project configuration but I can't find out what - so PLEASE help me ;)
Post Reply