rendercam icon indicating copy to clipboard operation
rendercam copied to clipboard

Render target / render tag components

Open subsoap opened this issue 5 years ago • 3 comments

I've been thinking about this problem but don't have a good solution I would suggest yet.

We do need a way with RenderCam to add/modify render target/material/tags without needing to make a copy of the render script. So there needs to somehow be a way to register and set the order of registered items of each kind. The material for render targets part may be a problem though as they are supposed to be setup in the .render file I think. We also don't yet have a way to dynamically make quad geometry based on scripts so the user needs to set that up still, but at least a basic one can be included with the package. I believe @britzl has been working on something related to this problem but it's not released yet.

subsoap avatar May 25 '19 01:05 subsoap

Being able to modify basic material tags and draw order would be easy (I think...), I don't know about the render target stuff though. What purpose are you thinking of? Lighting? Post-processing? For post-processing I guess you just need one render target, for the 2D lighting I tried I needed two, and conceivably you could need more. I'm not sure how you would make that into a nice API.

To be honest I have no idea what the list of materials in the .render file is for. With my 2D lighting test, I just have two samplers in the final render material, and do render.enable_texture with each of the render targets in the render script before drawing the final image.

rgrams avatar May 28 '19 17:05 rgrams

These materials are used here https://www.defold.com/ref/render/#render.enable_material

Yeah, things like FXAA too. https://forum.defold.com/t/render-target-example-fxaa/31925

It might be useful to just supply a few general use render target type materials of the most commonly needed types which can then be easily used. I can help set them up.

subsoap avatar May 28 '19 18:05 subsoap

The main problem atm still imo is that people need to make a copy of the project to modify the render script. So maybe version 1 of this would be to allow users to replace the list of render targets / draw calls if alternative lists are supplied in an included module.

On init have render script send a message to itself. Then when it processes that message all main scripts will have been allowed to init and all of the render predicates can be setup there. Either use the render predicates in the included module if they are set or use vanilla ones.

Then on update just see if there is a custom update function set in the included module use that instead of the vanilla update code.

subsoap avatar May 28 '19 18:05 subsoap