ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Announcements and Showcase
forum topic indicator I re-wrote CopperCube's realtime shadowing engine
person icon
studiorewired
Registered User
Quote
2026-07-17 02:06:04

After purchasing the source code for my game Trepidation (and thus forked CopperCube runtime into my own thing), I discovered the realtime shadow code had some issues. Shadows were quite disconnected from their corresponding models, and the low-res distant shadow map was refreshing with every frame draw, thus parsing all scene nodes within the render area per frame.

I went ahead and re-wrote most of it, keeping only the near vs far map distinction. The near map renders at up to 4096x4096 (500 units around the player, all realtime shadows + foliage and PCF filtered), while the far map is 2048x2048 (2,600-3,000 units around player). The far map uses some player camera heuristics to decide when to refresh the far map, up to once every 2.4 seconds. The downside with this approach is sudden camera moves can incorrectly light distant geometry when paired with LOD, but I've found it worthwhile. My implementation runs better than the original code in my testing.

I'll probably release or document my changes in more detail when I have time.

embedded external image
🔎︎

embedded external image
🔎︎

embedded external image
🔎︎

embedded external image
🔎︎


I also slapped together a video showcase: https://www.youtube.com/watch?v=...

person icon
laguniboy
Registered User
Quote
2026-07-17 02:56:34

Wow cool great job, keep us updated!

person icon
guest_guest
Guest
Quote
2026-07-17 07:55:42

Any chance to get these shadows working with OpenGL CopperCube?

person icon
studiorewired
Registered User
Quote
2026-07-17 08:57:23

guest_guest wrote:
Any chance to get these shadows working with OpenGL CopperCube?


Unfortunately, no. This required modifying the win32 engine binary. Coppercube studio edition only provides the source code to Windows & Android targets.

On OpenGL you could theoretically inject new shading into the browser context, but that would be difficult if not impossible to get working well.

person icon
Monks
Guest
Quote
2026-07-17 12:30:35

Good job studiorewired, will you share the binary file? Or is it private?

person icon
guest_guest
Guest
Quote
2026-07-17 13:34:48

I think you misunderstood @studiorewired, I was asking about CopperCube win32 publishing target with OpenGL instead of win32 DirectX render pipeline (no webGL involved at all)

person icon
studiorewired
Registered User
Quote
2026-07-17 16:08:08

guest_guest wrote:
I think you misunderstood @studiorewired, I was asking about CopperCube win32 publishing target with OpenGL instead of win32 DirectX render pipeline (no webGL involved at all)


Oops lol. I forget there's an alternative to DirectX for windows target / that the web target uses WebGL, not OpenGL. Neither are something I've used in my year-and-a-half working with CopperCube.

Unfortunately, my realtime shadow code only supports DirectX. Just to see what would happen, I tried compiling it for OpenGL and it runs but it doesn't render lighting.

person icon
studiorewired
Registered User
Quote
2026-07-17 18:08:55

Monks wrote:
Good job studiorewired, will you share the binary file? Or is it private?


I wasn't going to release it until I had a bundle of CopperCube tools ready to give to the community. But I also don't wanna gatekeep so here you go:

https://studiorewired.itch.io/co...

person icon
guest_guest
Guest
Quote
2026-07-17 20:15:30

Thank you very much @studiorewired for sharing!

person icon
guest_Robbo
Guest
Quote
2026-07-26 13:24:35

Nice work - Ive not touched the existing shadows in Coppercube as this replaces all fixed function materials and lighting. Might be worth it for outdoor terrains even still as you dont need many outdoor lights typically - its mainly an indoor thing.

I'd be happy to try out your new shadow code if you want to make the source public - seems like a nice upgrade actually. I'd be keen to test out your terrain LOD thing also and compare to the occlusion culling system I added from Irrlicht engine and see which is better overall.... up to you but would interested to see as good terrain performance has been a big thing for me also..


Create reply:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






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