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 Classic Chat / More problems, this time with Render Targets.

Author
Message
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 15th Jan 2016 13:22 Edited at: 15th Jan 2016 13:23
The video shows my issue.


It appears that render targets in seem to have mipmapping turned on by default, even when explicitly turned off. At close range, the texture looks ok, move away and it's block city.#

Also, The depth buffer appears to be wrong as objects are appearing in front of other objects when they shouldn't be, but that could just be my implementation as I haven't used a depth target. (They are drawn onscreen in creation order, with newer objects appearing on top of older objects)

The area within the white rectangle are the contents of the render target, which *should* map 1:1 with the main view, but are slightly off. (I explicitly used a power of 2 resolution. 1024x512)

Here's the code I used for the test... (You'll have to supply your own images.)

Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 15th Jan 2016 13:53
I noticed this: CreateRenderImage( 50, 100, 0, 0 )

This creates an image that is 50x100 pixels large. From what I can tell you want it to be 1024x512?

Then you should use: CreateRenderImage( 1024, 512, 0, 0 )

I didn't study your code that closely so I might be pointing out the wrong thing.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 15th Jan 2016 14:02
It's using a virtual resolution so should be 50% x 100%. You can tell when you're close to the box that the texture looks fine, so I don't believe it's that.

But thanks anyway.
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 15th Jan 2016 14:07 Edited at: 15th Jan 2016 14:09
I don't think the virtual resolution works like that I'm afraid. Only the virtual resolution is 100x100 pixels, this is like a grid on top of the real resolution. When creating a new image it doesn't use the virtual resolution, it uses the real resolution in pixels. This is why I am against using the "percentage system". It's not percentage, it's just 100x100 pixels stretched out to fit the real resolution. To me it looks like the resolution of the image is too low and is then stretched out.

Just give it a try and see for yourself.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 15th Jan 2016 14:09
I'll give it a try now, but look at the first few seconds of the video, the scales match up fine, which is why I'm doubting it...
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 15th Jan 2016 14:10 Edited at: 15th Jan 2016 14:10
It's super blurry even at the beginning of the video. You are just closer so the details on the object are larger as well.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 15th Jan 2016 14:11
Well I'll be gord damned. That fixed one issue! I should listen better in future!
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 15th Jan 2016 14:19 Edited at: 15th Jan 2016 14:19


I've messed around a lot with the virtual resolution. And I've used render images as well.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 15th Jan 2016 14:33
I prefer the virtual resolution, but I think the render target should be better explained in the help files.

It should state that the size is based on the device/window resolution, not the virtual resolution. Would have saved me a bunch of issues! lol



Now then, time to fix my depth issues! (Done!, used the depth target flag. )
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Jan 2016 15:20
Quote: "It should state that the size is based on the device/window resolution, not the virtual resolution"


Are you sure? I thought it was virtual resolution, stretched to a power of 2.

If I have a sprite that is 512x512 and a render target that is 512x512, but my screen is 1200x800, I have to squash my image vertically and ignore the bottom 25% of the render target.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 15th Jan 2016 15:23
All images work on real resolution. If you have the virtual resolution set to 100x100 (so called percentage system) and you load an image that is 100x100 pixels, then it will cover the entire screen. I also use virtual resolution, it's a great tool. But I don't think 100x100 and calling it percentage is a good idea. You are adding a layer of abstraction on top of resolution and that will cause confusion and potentially problems down the line. It's not the description of the command that is wrong. Although it could mention pixels to make it less confusing.

I think you should use virtual resolution as your target resolution. If your game is made for 1920x1080 then use that for virtual resolution, but adjust the virtual resolution based on monitor ratio or things get weird on 16:10 and 4:3 screens. Then AppGameKit will scale all content for you, and you get a perfect result every time. My default virtual resolution for Rush to Adventure is 200x120 (based on old 800x480 mobile screens) and is then adjusted at startup to work for different ratios. I support 240x120 to 200x150, or 2:1 to 4:3.

Login to post a reply

Server time is: 2024-11-17 02:57:30
Your offset time is: 2024-11-17 02:57:30