Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / SetImageMask() not working with SetRenderToImage()

Author
Message
JohnStabler
AGK Bronze Backer
10
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 11th Jan 2021 15:17
Hi,

I've tried getting some AppGameKit classic code to run in AppGameKit Studio but get an error when using SetImageMask() on an image I created with SetRenderToImage(). I'm assuming this is due to differences in the underlying engine and what operations are allowed on CPU / GPU.

Is there a workaround? I'm not doing it every frame, so I don't mind if there is a performance hit.

Thanks!
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 11th Jan 2021 15:20
You can try adding:

#renderer "Basic"

at the start of your program. If that fixes the issue, then yes it's a difference between Vulkan and OpenGL. If that doesn't fix it, the problem lies elsewhere.
JohnStabler
AGK Bronze Backer
10
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 11th Jan 2021 15:30
Thanks n00bstar.

Yes, that does fix it. So I suppose that makes it a less urgent problem.

However, I'm keen to use the Vulkan engine for performance benefits, so if anybody knows of a method / workaround that works in the Vulkan rendering engine then please let me know.
JohnStabler
AGK Bronze Backer
10
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 11th Jan 2021 15:33 Edited at: 11th Jan 2021 15:38
Maybe if I explain what I'm trying to achieve, other options may open.

I'm bashing together some textures with CreateRenderImage() and SetRenderToImage(). The last step involves applying a mask to feather the ages and vary the alpha channel across the image with another texture which is basically cloud noise.

Here's a video of the effect; notice the clouds surrounding the asteroids.

https://youtu.be/7OqKuzCEnf4
n00bstar
20
Years of Service
User Offline
Joined: 9th Feb 2004
Location: Montreal, Canada.
Posted: 11th Jan 2021 17:15
I'm not sure if I'm looking at the correct OpenGL version or the incorrect Vulkan version? I mean.. on my end this looks pretty damn good.

Or did you mean "i get an error" as in the program won't compile at all when under Vulkan?
JohnStabler
AGK Bronze Backer
10
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 11th Jan 2021 17:56
Sorry, that video is taken when running OpenGL. I was just trying to explain what I was doing so someone might have a workaround.

I have actually created a workaround. Create the image using SetRenderToImage(). Then save the image and use LoadImage() before SetImageMask(). As I said, I do it all during loading time, so it's not a problem. But it wouldn't be a solution if you needed to do some small image manipulations between frames.

The issue I now have is with SetShadowMappingMode(). When using the Vulkan renderer, my skybox isn't getting rendered when shadows are on.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 11th Jan 2021 20:04
As long as it doesn't happen every frame maybe try GetImage() rather than SetRenderToImage()

I think the problem is that Vulcan doesn't render transparency and if the image doesn't have transparency then masking doesn't work...i think

Login to post a reply

Server time is: 2024-04-27 01:16:56
Your offset time is: 2024-04-27 01:16:56