Closed gwald closed 10 months ago
Hello. Do you need an always invisible node or a node with geometry that goes invisible depending on some condition? If you need an always invisible node you can use group node. You can attach other nodes to it. As for streamable content, the way you described is probably the way to go currently (didn't use streamable content so have no experience here). If the stock engine functionality is not enough, you may have to develop custom extensions to extend the engine for your needs.
It's always invisible with no resources, and they are nested (tree of nodes), I then add (and remove) nodes with resources under some of them.
Thanks I will try h3dAddGroupNode
Yes that worked very well, thank you!
Sorry for reopening this, group nodes works... but I'm not getting shadows :(
I created a tree of group nodes then attach my nodes where I want it, render it and then remove all nodes at the start of each frame. I had to do it this way mostly because I dont want parent nodes automatically displaying child nodes.
I'm trying to replicate (abstract) the original PlayStation libGS (Graphic Service) hierarchical system. When using the PS1 coordinates functions (local to world & screen), TMK it only concatenates all the parent's nodes(coordinates), for rendering etc. A 3D object has a node (coordinates), not the other way around like h3d.
typedef struct _GsCOORDINATE2 {
unsigned long flg;
MATRIX coord;
MATRIX workm;
GsCOORD2PARAM *param;
struct _GsCOORDINATE2 *super;
struct _GsCOORDINATE2 *sub;
} GsCOORDINATE2;
typedef struct {
unsigned long attribute;/* pers,trans,rotate,disp */
GsCOORDINATE2 *coord2; /* local dmatrix */
unsigned long *tmd;
unsigned long id; /* reserved */
} GsDOBJ2;
So I'm not getting any shadows and I dont know if I missed something? or because of the group nodes? or because I'm removing nodes each frame?
I have the light on the camera like this, and new 3D instances are created as group nodes, then when rendered they are added to the scene using the group node.
// Add pipeline resource
g_pipeRes = h3dAddResource( H3D_ResTypes_Pipeline, "Pipelines/forward.pipeline.xml", 0 );
// Shader for deferred shading
g_lightMatRes = h3dAddResource( H3D_ResTypes_Material, "materials/light.material.xml", 0 );
h3dutLoadResourcesFromDisk( "./Content" );
// Add model resource
g_cam = h3dAddCameraNode( H3DRootNode, "Camera", g_pipeRes );
// Setup viewport and render target sizes
h3dSetNodeParamI( g_cam, H3D_Camera_ViewportXI, 0 );
h3dSetNodeParamI( g_cam, H3D_Camera_ViewportYI, 0 );
h3dSetNodeParamI( g_cam, H3D_Camera_ViewportWidthI, w );
h3dSetNodeParamI( g_cam, H3D_Camera_ViewportHeightI, w );
h3dSetupCameraView( g_cam, 60.0f, (float)w / h, 0.05f, 999999.0f );
h3dResizePipelineBuffers( g_pipeRes, w, h );
// *light_p = h3dAddLightNode( g_cam, buff, g_lightMatRes, "LIGHTING", "SHADOWMAP" );
*light_p = h3dAddLightNode( g_cam, buff, 0, "LIGHTING", "SHADOWMAP" );
The light material didn't make a difference.
The code base is a mess, I'm still figuring stuff out on both PS1 and H3D side.
game.c is the driver (game_init and game_update) the H3D files are under the PC folder, Y3D_PC.c Y3D.zip
Help would be appreciated figuring this out :)
Hello, I'll take a look today. Here a some tips. What node flags are you setting? If you are setting Inactive, then shadows also won't be drawn. I'll have to take a look at what NoDraw does and if it works correctly. Currently renderer skips all processing for nodes with NoDraw and does not generate shadows for nodes with NoDraw and NoCastShadow flags (see Renderer::prepareRenderViews() for more details). Check that you disable all the node flags when you activate the group node, maybe you disable only NoDraw flag.
I dont use node flags, I did test node flags and I couldn't use it to display a single 3D object in a tree (because it renders children and I dont want that), so I just add 3d objects (addnode) where I want them and than remove all 3D objects at the start of each frame, preserving the tree.
I'm sorry in advance to subject you to my horrible testing code.
I did a quick check of the code, and I noticed the following:
h3dUpdateModel( model, H3D_ModelUpdateFlags_ChildNodes )
. I noticed that problem several times, but do not know the root cause of this. Please also try removing and adding every second frame (for testing) - maybe it is the same problem that the first Horde's frame is different from the others, as some initialization is still done during the first frame.Thanks for the reply and suggestions :) I do appreciate it :+1:
And remove node is alternating each second, and then alternates each frame, I can't see shadows on the cube :/
I'm going to give up with this approach, I'll try the dummy model node trick.
I think h3d's node system needs to be looked at again and made more simple and flexible, a node should be a transform first then optionally something attached to it... especially for gltf
https://github.com/KhronosGroup/glTF-Validator/issues/14
And there should be an option (node flag) for turning off automatic child node processing, ie rendering and have the option to explicitly manage individual nodes.
Thanks again.
In the image you provided I see that cube is overlit so it basically becomes white. Please be very careful with Horde's light radius, because large radius may lead to undesired problems - that could be the cause of the shadow issues. I've noticed that you are using a light with a very large radius (h3dSetNodeParamF( *light_p, H3D_Light_RadiusF, 0, 99999.0f );
) and treat it as a directional light (at least some lights). Please note that currently horde DOES NOT support directional lights out of the box (unless you've added it to the engine) and emulating it with spotlight and large radius may lead to shadow issues.
Try limiting light radius and testing with one light, will it give any shadows/other results?
About node system enhancements - I think you can create an issue with your proposals and I'll try to implement it in version 3 of the engine, but when I'll start working on version 3 is another topic :)
Thanks for the tips. You were 100% right about wanting directional light, reducing it didn't help, so I made the models 10x smaller and it worked :)
I'll look at the node system and see if I can suggest something.
Thanks again for the help!
Hello guys,
It's my understanding that a hierarchical system or scene graph has nodes with and without a payload, ie 3D item. But I was reading this thread: http://horde3d.org/forums/viewtopic.php?f=2&t=1352&hilit=dummy+node
"Set the node invisible, attach the dummy geometry to the mesh, unload the geometry resource. Load the geometry resource, attach the geometry to the mesh, set the node visible."
This seems really like a fundamental limitation and very counter intuitive to me for such a simple use case, an invisible parent. Is this something that can be done a better way or fixed?