sebastian.vesenmayer Posted November 25, 2021 Share Posted November 25, 2021 Hello, I wanted to print the velocity vectors in the shader, it works in the editor but not in our application. I also activated the material->setState("deferred", 1); which is mandatory for the vlocity vectors. I only see the camera movement nvelocity vectors. Is there any other engine setting which does not trigger velocity buffer generation? Thanks Link to comment
silent Posted November 26, 2021 Share Posted November 26, 2021 Hi Sebastian, Do you have TAA enabled? I've checked with skinned meshes - they write velocity correctly (but you need to have very rapid animations, slow ones with small diff will be not visible in buffer): Can you send us your current material for your object that is not showing in velocity buffer? Is it static or skinned mesh? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
sebastian.vesenmayer Posted November 26, 2021 Author Share Posted November 26, 2021 (edited) I have modified the TAA shader to print the velocities on the screen, when I copy the material to editor it works. But it is not working in our application, Is there any other parameters in Engine core which combines position values to generate velocity buffer? I guess I am missing something here. custom_mesh_base.mat Pickup_red.at2_lambert2.mat Edited November 26, 2021 by sebastian.vesenmayer Link to comment
silent Posted November 26, 2021 Share Posted November 26, 2021 Can't see any issues with attached materials. You can also visually check that you have incorrect velocity if you will enable motion blur and reduce frame-rate (for example, will set render_max_fps to 25). Reducing framerate will result in a bigger delta between object's positions (so they will become brighter in velocity buffer). Also with incorrect velocity motion blur will not work (or produce artifacts). If you have correct motion blur for your object it would mean that everything is working fine. Please, keep in mind that you also can have negative values in the velocity speed and they will be showing in the velocity buffer as black color (0), and you may think that nothing is working, but on practice everything is fine. If possible can you also show us a minimal reproduction with these materials and objects (and espcially show us how do you move them)? Otherwise we can't determine the root cause of this issue (especially if you saying that it's working inside Editor, so it must work in the final app too). Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
sebastian.vesenmayer Posted November 26, 2021 Author Share Posted November 26, 2021 I have added this output to the taa fragment shader so i also see negative velocity if(uv.x > 0.5f) OUT_COLOR = float4(0.5f+velocity.x*10.f, 0.5f+velocity.y*10.f,0.0,1.0); But I don't see any velocity in different directions in our Application. I try to do a reproducer on this on our code structure. We are transforming our nodes by setTransform method. Link to comment
andrey-kozlov Posted December 1, 2021 Share Posted December 1, 2021 Hello Sebastian, The engine fails to detect that the node is moved, because movement happens before engine.update. engine.update increments the frame number and the node is not considered as being moved in that frame. So the fix is to place node movement after update (or inside update with AppWorldLogic::update/postUpdate as it intendent) 1 Link to comment
sebastian.vesenmayer Posted December 1, 2021 Author Share Posted December 1, 2021 Thanks andrey, I will try that. Is there any documentation on this? I am just curious because I haven't found it. :) Link to comment
andrey-kozlov Posted December 1, 2021 Share Posted December 1, 2021 Execution sequence section mentions that transformations should be applied during world update: https://developer.unigine.com/en/docs/2.14.1/code/fundamentals/execution_sequence/main_loop?rlang=cpp#update "The world logic update() function is executed: node parameters are updated, transformations for non-physical nodes are set and so on." In general case it's better to stick to that workflow. Outside of it it's some kind of gray zone where strange things can happen. I don't think there's a mention about particular velocity buffer case Link to comment
Recommended Posts