Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Custom OC Cel-Shader
- - By DaFatBrainbug Date 2018-03-22 01:45 Edited 2018-04-16 18:20
Hey guys!

This is the result of my efforts to change the look of Open Clonk to a comic-like style.
It's a modded CommonShader.glsl and ObjectShader.glsl you can replace in your Graphics.ocg folder.

I still don't understand every detail of the shader code and there are still things that could improve (cloud-like objects still look horrible in most situations).
There are a lot of settings you can tweak (including anti-aliased color transitions) and I marked/commented all the code I wrote.
Standard settings are my favourite.

Let me know what you think and have fun with it.
And feel free to mod it any way you want.

Update 1.1:
- Added a working optional outline shader. Still not looking that good, but I can't do any better for now. Messes with transparency cause I use alpha data to transfer other information.
- AA for all color transitions (sadly not for 3D-object outline)
- Optional hilite-shader (normal-based)
- Lots of small tweaks
- Modded ObjectShader.glsl is now also required

Planned for next release or as an extra shader: 16/256 color mode for textures.
New pics:



I hereby license the file CommonShader.glsl under the CC-BY license

I hereby license the file CommonShader-1.glsl under the CC-BY license

I hereby license the file ObjectShader.glsl under the CC-BY license
Attachment: CommonShader.glsl - Custom Cel-Shader 1.0 (10k)
Attachment: CommonShader-1.glsl - Custom Cel-Shader 1.1 (Common) (11k)
Attachment: ObjectShader.glsl - Custom Cel-Shader 1.1 (Object) (4k)
Reply
Parent - - By Sven2 [us] Date 2018-03-22 02:44
Cool! Is the shader built so you can just add one or more slices (so it could be enabled at runtime with AddFragmentShader)?

Or did you modify the existing slices?
Parent - By DaFatBrainbug [de] Date 2018-03-22 09:57
I did modify the existing slices. I don't think I can do it with separate ones, there is just to much happening.
But feel free to look at the code yourself and tell me if that could be possible^^
Reply
Parent - By Zapper [de] Date 2018-03-22 10:10
cool :D
Parent - - By Maikel Date 2018-03-22 11:54
Looks very good, the completely black edges beyond the light range are bit hard for my taste however. Also our current skies look terrible with this shading, is there a way to modify them in the same manner?
Parent - By DaFatBrainbug [de] Date 2018-03-22 12:00
You mean the 2D Sky-texture should be cel-shaded too? I think I can do that.
Hard black edges can be turned off in the shader settings.
Reply
Parent - - By Marky [de] Date 2018-03-22 12:13
I like it very much. I think I will use it for the Shire scenario, it would fit well there. I am just lazy and reluctant to keep updating it.
Parent - By DaFatBrainbug [de] Date 2018-03-22 12:17
You're welcome :)
Cool :) Looking forward to see it in action!
Reply
Parent - By Kanibal [de] Date 2018-03-22 21:05
Awesome!
Reply
Parent - By DaFatBrainbug Date 2018-03-22 23:13
Thank you all for the positive feedback :)
Reply
Parent - - By DaFatBrainbug [de] Date 2018-03-26 14:33 Edited 2018-03-26 16:18
Ok so I got another idea to get a working outline. Saw it here
Basically I want to render Mesh-Objects semi-transparent, so that areas where the modle is the thickest will be opaque.
Then I could check (from standard player viewpoint) what parts would be drawn opaque and color those parts in black. Then revert transparency changes.

However, no matter where I put my fragColor.a = 0.5; I can't get the models transparent.
I get transparent trees, landscape, groundobjects ... basically everything but the models.

How do I do it? Please help.

Edit: Thinking about it, fragColor doesn't evenn make sense, 'cause I want model-textures to be transparent. But I can't find values for textures that indicate alpha.
Reply
Parent - - By Clonkonaut Date 2018-03-26 22:24
If trees are affected, the only reason I can think of as to why: trees use 'scene_blend alpha_blend' in the material. There are a couple of objects using this for transparent textures. Maybe it only works on those objects?
Reply
Parent - By DaFatBrainbug [de] Date 2018-03-27 08:50
Yes, that worked, thanks!
The object needs the 'scene_blend alpha_blend' in the material file defined
Reply
Parent - By DaFatBrainbug Date 2018-04-16 18:17
Released Version 1.1
Updated main post
Reply
Up Topic Development / Developer's Corner / Custom OC Cel-Shader

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill