Multiple passes rendering support in one rendering call
I'd like to implement fur effect described in this post: http://www.xbdev.net/directx3dx/specialX/Fur/index.php The fur need to be rendered layer by layer. In filament API call it may be like this:
if (renderer.beginFrame(swapChain)) {
for(int layer = 0; layer < layerCount; layer++){
//update some param
renderer.render(view);
}
renderer.endFrame();
}
The next rendering result needs to be mixed with the previous rendering result. Does Filament support multiple passes rendering in this situation? We try it but it seems that driver.beginRenderPass call will clear the color buffer. If we use View.setClearTargets(false, false, false), we got a blurred screen. Does Filament support multiple passes rendering in this situation? Or are there any other ways for us to implement this feature?
You can render multiple views yes, do you have more details about what you are seeing and what you are trying to do exactly?
You can also check out the bloom sample which shows how to render into offscreen targets. You can render into a target and then use that target as a texture for the next rendering step. This seems like a better approach for your use case than rendering multiple times in the same buffer.
I'd like to render like this, layer by layer. Render first layer in the first rendering step, then second layer, then third layer, etc. All layers are using same gltf model and rendering in the same texture. It's hard to render into a target and then use that target as a texture for the next rendering step because the rendering area of different layers are not totally covered, so it's impossible to blend the green area of first layer and second layer as the area of second layer doesn't cover green area. Or should I just add first layer as a renderable entity to the scene?
To do this you should be able to render a View multiple times. You'll definitely want to turn off screen clearing for the second, etc. layers, but keep it on for the first layer. The easiest way to do this is to use multiple View instances (they can share the same camera/scene/etc.). You may also want to turn off post-processing on your view(s).
We do something like this in our samples for imgui, for an example see these lines of code.
note that you'd have to turn off post processing currently, due to a known limitation/bug (we're not blending views when post-process is enabled).
You should be able to use custom RenderTargets for this. With recent version of filament all this should be possible.
We do something like this in our samples for imgui, for an example see these lines of code.
this link is invalid
@kaelsass 请教下大佬最后选择了什么方案,multi view?
Updated link is here, which demonstrates a simple multi-view scenario. For custom blending between layers, you would need to use our RenderTarget API (see our rendertarget.cpp demo for that)
setClearTargets
there is no setClearTargets function in View class
You can render multiple views yes, do you have more details about what you are seeing and what you are trying to do exactly?
You can also check out the bloom sample which shows how to render into offscreen targets. You can render into a target and then use that target as a texture for the next rendering step. This seems like a better approach for your use case than rendering multiple times in the same buffer.
HI @romainguy , is the bloom sample you mentioned is bloom post-process?
@kaelsass 请教下大佬最后选择了什么方案,multi view?
我也想实现fur,可以交流一下么?