Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Announcements and Showcase
Screen Shaders Extension

just_in_case
Moderator
Quote
2023-11-20 16:30:07

🔎︎


Just released a new extension that allows you to use Screen Shaders with CopperCube games or projects, this shader utilizes the RTT API that's already available to use in CopperCube 6.

Shader works with both OpenGL and Direct3D drivers.
It works without breaking any of the internal lights, shadows, or fog.

It opens up a lot of possibilities to add your own Post Effects like Bloom, DOF, Noise, Distortion, and whatever other effects you want to use with the same method. However, they don't come by default with the shader extension but you can easily port them from Shadertoy https://www.shadertoy.com/

Right now the shader comes with basic properties to adjust for the screen.

Brightness
Contrast
Hue
Saturation
Vibrance
Tint
Gamma
CRT_effect (Ported from shadertoy)

Most of the properties are adjustable with variables.


ScreenShader.Brightness

ScreenShader.Contrast

ScreenShader.Hue

ScreenShader.Saturation

ScreenShader.Vibrance

ScreenShader.Gamma



You can download the extension for free from my itch.io page here:-
https://vazahat.itch.io/screen-s...

Watch the usage video here on YouTube:-
https://www.youtube.com/watch?v=...

Now I want you guys to port some cool shaders from Shadertoy and throw them in so that people can use them and benefit from them.

It also adds a possibility to ditch the third-party injectors for effects like CRT and other screen effects. You can also create your own PSX-style shaders and apply them to the RTT object and you are done.

Hopefully you guys will find this information or extension useful


Note:- It only works with CopperCube 6.6 and above. It won't work with earlier versions of CopperCube.


Robbo
Guest
Quote
2023-11-20 22:58:31

Nice addition just_in_case.

You will need to adjust the distance from the camera when the user changes the Camera FOV though.

I had the same issue when I added something similar into my game.

I fixed this with this formula:

// distance from camera when matched at 70 degrees
var dist = 1.804;
// get half and convert to radians
var theta = saveFov * 0.5 * 0.0174533;
// get hypotenuse length
var step1 = dist / Math.sin(theta);
// get other side length - full
var screenAdj = Math.sqrt((step1 * step1) - (dist * dist)) * 2;
var ovN = ccbGetSceneNodeFromName("Overlays");
ccbSetSceneNodeProperty(ovN, 'Position', 0, 0, screenAdj);
ccbSetSceneNodeProperty(spdWheel, 'Position', 0, 0, screenAdj);


just_in_case
Moderator
Quote
2023-11-21 00:59:13

@Robbo, yeah I am aware of this and already know this, you need to do the same with the scale when you change the aspect ratio as well, so I know that scale and distance need to be adjusted when changing the parameters of the Camera.

I am just too lazy to add them in, most of the developers don't change the Aspect Ratio and FOV during runtime so that won't be a problem, maybe in future versions, I will add something to auto-workout distance and scale.

Also, FOV for me only works when I use Auto Aspect Ratio, as in my video I have shown that I am using a fixed aspect ratio of 16:9, so the changing of FOV during runtime won't work there, at least not for me.

In future versions when I update my extension to work with auto aspect ratio then I will add the fix for FOV as well.


ccbfan
Guest
Quote
2023-11-21 18:52:30

Great work! Screen shaders opens a lot of possibilites for great effects


laguniboy
Registered User
Quote
2023-11-21 22:04:57

@just_in_case

Wow cool, will it work with anti-alias on.


just_in_case
Moderator
Quote
2023-11-22 04:22:46

Thanks, guys for your feedback, yeah with screen shaders you can do almost any kind of screen effects or post effects.

@laguniboy, I don't think it will work with Anti-Alias on, but you can give it a try if it works or not, I am not sure though.


Robbo
Guest
Quote
2023-11-23 04:53:20

Very nice to way to add color variance plus other animated screen shaders to CopperCube.

I have added in my own 1x1 3d plane mesh and was able to get it to exactly line up to the screen behind it using these figures:

- add child 3d plane mesh at positon: 0.0, 0.0, 4.28
- scale mesh based on min 6 on Z axis: 10.667, 0.0, 6.0

(to update screen resolution just multiply the fixed 6.0 on the z axis by width/height = for 1920 x 1080 will be 6 x 1.7777 and change the x axis amount only.

(I could tell as had screen text dispalying and if not 100% the same will overlap and show both sets)


andgameplay
Registered User
Quote
2023-11-23 16:49:14

Amazing! Thanks Just_in_case!


Robbo
Guest
Quote
2023-11-24 12:01:45

I thought to check for any hit on performance and was pleasantly surprised...

I actually got better framerate using all default settings by about 10-15% which is unexpected benefit. Also the 60 fps limit seems to go away somewhat when using it.

Did anyone else get the same results ?


Robbo
Guest
Quote
2023-11-24 12:17:35

Just confirmed when running I am getting a max of exactly 3 x the limit of the FPS set in the publishing menu so 60 (normally actually around 62.8 fps will go to max 188.4 fps and so will other max fps normally.

I got over 1,000 fps when making the limit to 295 (in game around 334 max).


Guest
Guest
Quote
2023-11-24 15:07:12

Truely amazing job JIC, you really are a star here, without you I couldn't imagine the community to be still surviving, you always keeps me amazed by the stuff that you bring in here.

Thanks a thousand for this really wonderful extension, and not only bringing the extension but also for sharing that we can do anyoind of screen effects with it.

Best part is that, it won't affect the performance at all. Hat's off to you sir.

I wish you all the best and a healthy life.


Robbo
Guest
Quote
2023-11-25 23:40:24

It seems that certain parts of the engine will run faster when activated - the FPS controller no longer does smooth acceleration probably due to not using delta time to adjust in the source code - I will have a look at that...

I like to see accurate real time FPS to see any and all performance on anything I add to the engine but when done, the released game will come in 2 versions - 60 FPS and 144 FPS (for high end monitors)...that's all I need.

In my game I often get away from using high frequency calculations on every single frame as its wasteful and unnecessary so in my code tend to run everything at set fixed speeds rather than using whatever the current FPS is every frame. Its far better that way so long as the FPS doesn't drop below the minimum to get smooth transitions then its ok. You can still add in delta time anyway along with fixed updates to cover scenarios where it drops below 30-40 FPS.


just_in_case
Moderator
Quote
2023-11-26 07:25:49

Thanks a lot guys, I am glad the extension is of any use to the community, and it is not affecting the performance. I am willing to see the usage of this extension with different shaders in some games


VP
Guest
Quote
2023-11-27 12:56:09

Followed the tutorial. Unfortunately I can't get it to work. Tried a few times but no luck. Here's my test ccb. NOt sure what I'm doing wrong...

https://mega.nz/file/SKRABZTTU9Z...


VP
Guest
Quote
2023-11-27 13:02:28

The forum modifies mega download links. Just past a hash symbol in the link (where the first hyphen symbol is) to fix it.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internation?l" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact