Page 10 of 16

Posted: Sat Jan 26, 2008 2:43 pm
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.

Posted: Thu Jan 31, 2008 4:34 am
by etcaptor
OK, I just adapted shogun's plugin for your trees to VisualEditor.
http://irrlicht.sourceforge.net/phpBB2/ ... 8&start=60

Posted: Tue Mar 11, 2008 7:38 am
by doqkhanh
:shock: Very very usefull, thanks very much!

Cound not load .irr file with tree

Posted: Sun Mar 16, 2008 9:41 am
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]

Posted: Sun Mar 16, 2008 4:48 pm
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();

Posted: Sat Mar 22, 2008 4:21 am
by doqkhanh
:( Anyone has HLSL for leafnode?
Please help me !

Texture linking with Irredit plugin

Posted: Sun Mar 30, 2008 3:30 pm
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

Posted: Sun Mar 30, 2008 5:19 pm
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

Posted: Sun Mar 30, 2008 6:20 pm
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).

Posted: Mon Mar 31, 2008 12:38 pm
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.

Posted: Mon Mar 31, 2008 11:15 pm
by shogun
That's strange, I never had problems with the material. Could you upload a test scene and your tree-file?

Posted: Tue Apr 01, 2008 11:45 pm
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

Posted: Wed Apr 02, 2008 11:50 am
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).

Thanks

Posted: Wed Apr 02, 2008 7:05 pm
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

Posted: Mon Apr 07, 2008 1:16 pm
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 ;)