Hi folks!
Today, I was trying to figure out how to write my own component class based on drawable class.
My trying it’s fully based on BillboardSet component.
i’m write some minimal code and trying to debug it. for this i’m set some breakpoints for few methods of my component.
it’s creates successfull as node’s component
[pastebin]X2r4RRzb[/pastebin]
but it’s do not execute any of drawable methods after creation (and setup some set’s methods)
the drawable methods such as - Update, UpdateBatches, UpdateGeometry, they do not called at all, why ?
It may be that it never generates geometry -> bounding box is empty or undefined -> it doesn’t pass culling.
Drawable::Update() is not called automatically each frame, rather you must mark the drawable explicitly to need an update. It will then be performed at the same time as the octree updates itself. See MarkForUpdate() and the AnimatedModel / ParticleEmitter classes.
Also note that you don’t necessarily need Drawable::Update() at all, if all you want is a periodic tick update that is independent of the octree / view processing you can also just subscribe to the frame tick events.
Ah ok, did not notice that you had overridden that one with an empty function at first. Drawable::OnNodeSet() is responsible for adding the drawable to the octree, and indeed without that the drawable won’t participate in rendering at all.
i don’t know but in case dual tail with high rotation it’s looks wierd.
I use delta-move based method for spawn base points of tail path.
maybe it’s wrong method ?
it is called every frame in engine, then batches are going to prepare for render or no ?
i just want to split my logic of building mesh in work thread and put ready compiled mesh data in the main thread with helps of few lines of the code.
i’m trying to prepare mesh data in worker thread and then it’s ready it copying in main thread to vertex buffer, but after few seconds i got an freez. i guess that something i doing wrong. now i rewrite code all without workers, all stages going in main thread (i guess).
today i’m find a strange effect
then i setup the batch in constructor as:
batches_[0].geometryType_ = GEOM_STATIC;
i got a more constast colors on tail’s
and then i setup batch as :
batches_[0].geometryType_ = GEOM_BILLBOARD;
i got an more lower contrast on tail’s
Why this is happens ?
And what type of geometry tails should be?
also i’m find what using Splines for tail path( + color fade) interpolation it’s extremely slow, moreover this dramatically slow on fps
in this case i’m rewrite vertex color (fade/color gradient) interpolation from spline’s to vector lerp
STATIC geometry is the normal mode for meshes, ie. vertices in vertex buffer are transformed by viewproj and model matrices. BILLBOARD means a different kind of transformation where a point is transformed and then offsetted by a size parameter to get a quad. Look into Transform.hlsl (.glsl) to understand how the shader is transforming the vertices.
STATIC geometry is the normal mode for meshes
Ok.
And about shadows.
If i’m create even the one tail component for any node in all scene, the shadows from bots began looks weird - like an old style shadows with blobs.
And if scene no have any tails the shadows draws - ok
I think what i’m must do something for shadows for tail.
Turn off shadow from tail at all or make some basic shadows functionality.
If you’re still setting a huge bounding box for your object, it will cause the shadow rendering to believe there’s a huge object that needs to cast/receive shadows, and the shadow resolution will suffer. You should use a bounding box that encloses your geometry tightly.
tailNode->CreateComponent<TailGenerator>();
tailNode->GetComponent<TailGenerator>()->SetTailLength(0.5f); // set segment length
tailNode->GetComponent<TailGenerator>()->SetNumTails(50); // set num of segments
tailNode->GetComponent<TailGenerator>()->SetWidthScale(4.0f); // side scale
tailNode->GetComponent<TailGenerator>()->SetColorForHead(Color(1.0f, 1.0f, 1.0f));
tailNode->GetComponent<TailGenerator>()->SetColorForTip(Color(0.0f, 0.0f, 1.0f));
Thank’s guys, but I think that the component is still far from ideal. And requires some modifications.
Among the main - remove two Batchs and draw two strips with a single batch with degenerate triangle in middle of IB.
I tried draw tail with one batch but I for some reason did not work.
The second problem is when you need dynamic tail from static object.
This component can only generate tail from the dynamic objects (that change own position in time)
Dealt with generating a single tri-strip
you mean that now you have one-batch for these 2 strips ?
Makes for interesting twists.
I guess that you need do some tests this with chaotic node movements (Brownian motion) to avoid strange twists and do some polish to alg for looking-well tailepath in most cases.
Everything works inside the editor with attributes for all settings and sane defaults.
Wow, cool) Is it generate tail on play button or even then editor in standby mode ?