Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a post processing toon shader #18

Closed
bdero opened this issue Mar 9, 2016 · 3 comments
Closed

Use a post processing toon shader #18

bdero opened this issue Mar 9, 2016 · 3 comments
Assignees

Comments

@bdero
Copy link
Member

bdero commented Mar 9, 2016

For meshes with many different materials, setting up custom toon shader materials post-import is impractical, especially since the properties are overridden with every import cycle.
It would be better to just run the rendered scene through a general post-process toon shader, and only fiddle with custom post-import materials in special cases.

I'm not sure if godot supports post-processing shaders yet.

@bdero
Copy link
Member Author

bdero commented Mar 9, 2016

I asked in IRC about it, and it looks like I can sort of hack around the limitation by placing the material on a quad in front of a Camera2D:

(01:00:55 AM) bdero: Is there currently any way to use a shader for post-processing in godot?
(01:01:49 AM) dc1a0: I'm only starting to use shaders bdero, so, I wouldn't be of that much help.
(01:03:09 AM) falsaber: I didn't do much with them either, did you check the shaders demo, bdero?
(01:05:55 AM) bdero: It looks like it can be done by specifying a material for Camera2D, but I'm trying to figure out if it can be done when rendering using a 3D cam
(01:06:03 AM) bdero: I'll try looking at the shaders demo
(01:09:46 AM) bdero: Looks like the 3d shader demo has no custom post-processing shaders
(01:10:21 AM) Einlander: you're doing 3d post processing?
(01:10:56 AM) Einlander: i've heard people make a quad over the viewport in 2d
(01:10:58 AM) bdero: I'm trying to figure out if it's possible in godot
(01:11:06 AM) Einlander: and minipulate that
(01:11:08 AM) bdero: ah, hmm
(01:11:26 AM) Einlander: wether you can use that for things like fog or ssao i have no idea
(01:11:41 AM) Einlander: but color correction and image warping might work
(01:12:44 AM) bdero: So long as there's some way to pipe the Camera3D's texture through a post processing shader, I'm good
(01:13:34 AM) Einlander: i think there is a function to gab the image from the camera
(01:15:21 AM) PYROGXPILOT: "render"
(01:18:50 AM) bdero: Looks like maybe I can do viewport.get_render_target_texture() and pass the texture as a param to a ShaderMaterial
(01:21:48 AM) Einlander: the real question, can we get the other renders?
(01:21:55 AM) Einlander: like depth and normals?
(01:22:35 AM) bdero: Not by the looks of it
(01:24:03 AM) bdero: Thanks for the heads up - it looks like from here I can get the results back out to the user by placing a quad in front of a Camera2D and just setting the material
(01:24:19 AM) bdero: like you mentioned
(01:24:53 AM) Einlander: is this for 3d?
(01:25:03 AM) Einlander: or 2d
(01:27:23 AM) bdero: Just passing the viewport output to a ShaderMaterial, so it shouldn't matter whether it's 3d or not
(01:27:34 AM) bdero: as long as I can get that texture, which it looks like I can
(01:27:43 AM) Einlander: ah

@bdero
Copy link
Member Author

bdero commented Mar 13, 2016

A precursor to this work was factoring out the camera into it's own entity, which is done now. The way it works is that the camera's scene is a child of the main Node, and whenever a new "camera system" pops into existence (i.e. the Player), it tells the camera which node it should start snapping it's transform to by calling set_camera_system(node) when entering the tree.

From here, a Camera2D can be added, and hopefully piping over the output of the 3D camera to a shader attached to a quad won't be a problem.

@bdero bdero self-assigned this Mar 13, 2016
@bdero
Copy link
Member Author

bdero commented Mar 14, 2016

I can't seem to get the viewport to use the 2D camera so long as there's any 3D camera anywhere in the node tree.

I did a good amount of experimenting with this and I'm going to close it out for now and proceed with overriding individual materials.
Materials will need to be overridden for most things anyhow, and we should unify materials for meshes with complicated material setups by baking diffuse/normal/specular maps regardless.

@bdero bdero closed this as completed Mar 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant