marinos.giannoukakis Posted November 18, 2016 Posted November 18, 2016 I would like to create a tessellation material that is going to accept in the "height" texture field the output from a pixel shader, how would i go about to do that....??? i am guessing this is kind of like a multipass shader that i need, something that would allow me to write the output of the pixel shader to a buffer and then feed that buffer to the evaluate shader or something similar to that....?? please can you outline ways of achieving that....? I repeat what i want to do is essentially to take the output of a custom pixel shader and use it as a texture in the evaluate shader in a custom tessellation material.....
helmut.bressler Posted November 30, 2016 Posted November 30, 2016 Hello Marinos, when you are rendering into the heightmap texture, what would be the geometry and what would be the camera position ( are you rendering a screen aligned quad or a node?) For these kind of tasks we are typically creating a C++ plugin which performs the rendering, but maybe that is not needed in your case. Cheers Helmut
marinos.giannoukakis Posted December 4, 2016 Author Posted December 4, 2016 Thanks for the answer Helmut, but that as you point out is not what i need in my case.... is probably much simpler in my case, I just need simply the output of my pixel shader to go to a buffer where i could set the tesselation shader to read the heightmap from.... By the way this means that the question has yet to be answered so any technical help would be welcome...... and needed.... !!!!!
helmut.bressler Posted December 6, 2016 Posted December 6, 2016 Sorry, I guess I do not fully understand what you mean. I don't know about the current status of tesselation materials, but in the "Release plans" forum thread it is mentioned that it will have a comeback. For reading the output of a pixel shader two Solutions are coming to my mind: - The auxiliary texture: you have to add an auxiliary pass for your material which runs your pixelshader. The result will be written into the auxiliary texture. (At least in post materials ) You can access the auxiliary texture through <texture name="auxiliary" pass="post" type="procedural"/> in your material (I don't know what happens if you access the auxiliary texture before the auxiliary pass has been rendered, do you get the result from the previous frame?) - you can write a custom c++ plugin in order to render a single Node or the whole world into a texture. As a starting point I would recommend looking at the source code of the AppBorder plugin: source\plugins\App\AppBorder\AppBorder.cpp If you have a c++ programmer available I would recommend the second approach, because you have no controll over the size and the pixel format of the auxiliary texture. Good luck an cheers Helmut
marinos.giannoukakis Posted December 6, 2016 Author Posted December 6, 2016 the first option (and not the second fortunately for me :) ) is exactly what I am trying to do, and the way you describe it is exactly how i try to do it... but it does not seem to work as i would expect... and yes is the previous frame that I want to read...exactly as you described it.... Thanks I will give another try to the aux pass, for some reason my results were not they should.... :/
helmut.bressler Posted December 7, 2016 Posted December 7, 2016 Ok I see. Did you bind the auxiliary texture correctly? I guess in the material file it should be something like <texture name="auxiliary" type="procedural" unit="0" shader="all"/> An example of how to specify tesselation in the material can be found in the water material: data\core\materials\default\unigine_water.mat I can remember that numbering of texture units for non-pixel shaders in OpenGL was not straight forward, at least before UUSL (I don't know if that behaviour has been changed, please have a look at this forum thread: https://developer.unigine.com/forum/topic/3515-solved-gl-texture-in-vertex-shader/ ) Ohterwise I can only recommend to use a graphics diagnostic tool (something like visual studio graphics analyzer, RenderDoc or glIntercept ...), because this is the only way to find out if your texture is actually really reaching your shader. Cheers Helmut
marinos.giannoukakis Posted December 9, 2016 Author Posted December 9, 2016 Thank Helmut that was quite helpful....
Recommended Posts