I'm trying to render some stuff to a texture and later stretch that texture over the screen, but it seems RenderTarget doesn't have Nearest / Linear modes like Bitmap components?
Also I must have set something wrong, the results I'm getting do not look like they're scaled correctly (resulting in the image being "unevenly blurry" as opposed to smoothly antialiased), I'm attaching the project like I currently have it set up. What am I doing wrong?
RenderTarget unexpected results (blurry)
Moderator: Moderators
RenderTarget unexpected results (blurry)
- Attachments
-
- Scrolling in low res 01.zgeproj
- (124.92 KiB) Downloaded 437 times
Re: RenderTarget unexpected results (blurry)
Hi,
Setting the rendertarget-properties so it has the same size as the viewport makes it look good here:
Setting the rendertarget-properties so it has the same size as the viewport makes it look good here:
Code: Select all
<RenderTarget Name="ScreenProjection_rt" Width="0" Height="0" ClearColor="0.6235 0.8588 1 1"/>
Re: RenderTarget unexpected results (blurry)
Hi rrTea,
- Since you're using a target resolution of 160x120 you should set App.ViewportRatio to 4:3.
- When you use a viewport ratio you shouldn't use the App.ScreenWidth & App.ScreenHeight values to calculate the aspect ratio. Either just enter the values you're using ( Ratio = 4/3 ) or use App.ViewportWidth & App.ViewportHeight*
*Personally i prefer simply resetting the matrices in a RenderTarget situation though ( see attached demo ).
K
Correct, no idea why it doesn't. Fortunately you can do-this-yourself quite easily using a OpenGL call ( see attached demo ).rrTea wrote:I'm trying to render some stuff to a texture and later stretch that texture over the screen, but it seems RenderTarget doesn't have Nearest / Linear modes like Bitmap components?
Two things ...rrTea wrote:IAlso I must have set something wrong, the results I'm getting do not look like they're scaled correctly (resulting in the image being "unevenly blurry" as opposed to smoothly antialiased), I'm attaching the project like I currently have it set up. What am I doing wrong?
- Since you're using a target resolution of 160x120 you should set App.ViewportRatio to 4:3.
- When you use a viewport ratio you shouldn't use the App.ScreenWidth & App.ScreenHeight values to calculate the aspect ratio. Either just enter the values you're using ( Ratio = 4/3 ) or use App.ViewportWidth & App.ViewportHeight*
*Personally i prefer simply resetting the matrices in a RenderTarget situation though ( see attached demo ).
K
- Attachments
-
- Demo.zgeproj
- (1.89 KiB) Downloaded 454 times
Re: RenderTarget unexpected results (blurry)
Ah, I didn't understand the original question correctly. Now I see that you intend to render to lower resolution and stretch it. Indeed, we should add filtering options to rendertarget-component.
Re: RenderTarget unexpected results (blurry)
Isn't the ViewportRatio in my example 4:3 anyway since I'm using 800*600?Kjell wrote:- Since you're using a target resolution of 160x120 you should set App.ViewportRatio to 4:3.
Anyway I tried setting it like that too but that didn't help with what bothers me the most: the image looks... off? Weirdly blurry, as if it were an image scaled using a mix between Linear and Nearest (especially visible on edges of the rotating cube) while it's neither. Is there anything I can do about it?
Re: RenderTarget unexpected results (blurry)
Haa just tried the new build (with added filtering options), looks great! Thanks!
Re: RenderTarget unexpected results (blurry)
Hi rrTea,
K
Ah, i tried your project inside the IDE ( using the Preview feature ), which i usually have scaled to 16:9.rrTea wrote:Isn't the ViewportRatio in my example 4:3 anyway since I'm using 800*600?
As i mentioned in my post ( and showed in the demo ), you needed to switch your RenderTarget to nearest neighbor filtering using a OpenGL call. But since Ville already added a property for that on RenderTarget, there's no need for that anymorerrTea wrote:Anyway I tried setting it like that too but that didn't help with what bothers me the most: the image looks... off?
K
Re: RenderTarget unexpected results (blurry)
I see, thanks for the clarification, but yes you're right I should have set it to 4:3 explicitly (and use Viewport) so it works in the IDE too.Kjell wrote:Ah, i tried your project inside the IDE ( using the Preview feature ), which i usually have scaled to 16:9.