Jump to content

[SOLVED] MeshDynamic


photo

Recommended Posts

I'm trying to write a few post process shaders in a C++ plugin that apply on textures. I've looked at the AppOculus as an example and copied it's usage of TextureRender, Shader and FFP to apply a post process shader on the full image. This worked in one case where the mapping was 1:1 (each input pixel corresponding to one output pixel), however in the other case there is a geometry shader in between to create (potentially) multiple outputs from a single input. So rather then a full screen quad, I need to render a point list with one point for each pixel to process. FFP doesn't allow point rendering though, and I also don't think that building up this list of points from scratch every frame is very good for the performance. Would it be possible for MeshDynamic or similar to be exposed to API so I can create a custom buffer and render it? I known ObjectDynamic is exposed, but it does not allow rendering it directly, it's part of the scene. I did manage to make a working prototype using FFP that renders lines (rather then points) and having the geometry shader ignore the second vertex of each line, so I know the algorithm is working, but this is not an ideal solution.

Link to comment

Hello, Michiel!

 

I think the best way is to use ObjectDynamic as it has point rendering mode and it also solves the problem about feeding FFP with the point list every frame so you don't have to do that. If it doesn't suits your needs then it's possible to get raw DirectX device and do whatever you want to do though it won't work with OpenGL.

 

I'll ask our devs about adding point mode to FFP by the way.

Link to comment

Is there a way to explicitly render a single ObjectDynamic, without special effects? It does not have a render function exposed in the API. To render using renderViewport() or renderNode() with only this object I would need to disable every fancy effect as deferred lighting, scattering, glow and such or it would kill the result. The MeshDynamic class, which is internally used by ObjectDynamic, seemed to be supporting plain old rendering the buffer using the currently bound shader.

Link to comment

Try to use Unigine::Render::renderNode method (https://developer.unigine.com/en/docs/1.0/cpp_api/reference/api_render_class#c_renderNode_constmat4n_constUNIGINE_MAT4n_constNodePtrn_constcharm_int_int_int).

 

By the way, you can create new material which will skip almost all passes (except ambient I guess) and then assign that material to ObjectDynamic so you don't have to disable every rendering feature.

Link to comment
×
×
  • Create New...