Re: [racket-users] mode-lambda with antialiasing?

2016-11-15 Thread David Vanderson
On Mon, Nov 14, 2016 at 6:50 PM, Jay McCarthy 
wrote:

> I could be wrong, but I don't think that there's an obvious
> anti-aliasing algorithm that fits mode-lambda's use cases. I would
> recommend rendering at a high buffer size and then down sampling. I
> attached a version of your program that does this.
>

I think this would work for me, but with your changes I still get the same
output.

I got half of what I'm looking for by changing GL_TEXTURE_MAG_FILTER to
GL_LINEAR, which worked for sprites with a scale >= 1.0.  I don't
understand why changing GL_TEXTURE_MIN_FILTER doesn't make any difference.

Maybe I'm going against the mode-lambda grain too much here, but I'm really
enjoying all the work you did with shaders and sprite organization.  Thank
you!

Do you think I should continue with mode-lambda or try something else?  Any
advice?

Thanks,
Dave

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] mode-lambda with antialiasing?

2016-11-14 Thread Jay McCarthy
On Mon, Nov 14, 2016 at 5:25 PM, David Vanderson
 wrote:
> Thanks Jay, I hope I'm not abusing the terminology.  If I have a sprite that
> is a line, and it's rotated a bit, then is that not similar to a polygon
> edge not falling on pixel boundaries?

Yes, that's what I meant by the rotated rectangles.

> As an example, I've attached a test program and a screenshot of the rotated
> and scaled down line segment.  This is the sort of thing I'm worried about.
> Any advice?

I could be wrong, but I don't think that there's an obvious
anti-aliasing algorithm that fits mode-lambda's use cases. I would
recommend rendering at a high buffer size and then down sampling. I
attached a version of your program that does this.

FWIW, since mode-lambda is imitating the SNES, it didn't really have
this problem because rotation only worked for the background layer in
Mode 7 and is almost exclusively used for chunky things rather than
fine things, so you wouldn't see bad aliasing of foreground elements.
However, looking at any Mode 7 effect, you instantly see the aliasing:

http://images.nintendolife.com/screenshots/16705/large.jpg

http://img.gamefaqs.net/screens/8/9/8/gfs_40216_2_4.jpg

http://media.tiltingatpixels.com/tilting/final_fantasy_4_flying.png

> I didn't know that mode-lambda made sure that each pixel only came from a
> single sprite.  Even if some sprites have some transparency?

Within a layer, there is no transparency. Transparency is only across
layers. Section 1 of the docs says, "mode-lambda makes no guarantees
about the layering and transparency behavior of sprites within a
single layer."


-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ml-line.rkt
Description: Binary data


Re: [racket-users] mode-lambda with antialiasing?

2016-11-14 Thread David Vanderson
Thanks Jay, I hope I'm not abusing the terminology.  If I have a sprite
that is a line, and it's rotated a bit, then is that not similar to a
polygon edge not falling on pixel boundaries?

As an example, I've attached a test program and a screenshot of the rotated
and scaled down line segment.  This is the sort of thing I'm worried
about.  Any advice?

I didn't know that mode-lambda made sure that each pixel only came from a
single sprite.  Even if some sprites have some transparency?

Thanks,
Dave

On Mon, Nov 14, 2016 at 2:20 PM, Jay McCarthy 
wrote:

> Hi David,
>
> I know what anti-aliasing is, but I don't think I know how you mean it
> to apply for mode-lambda.
>
> mode-lambda renders a W1xH1 scene onto a W2xH2 canvas and by default
> uses a scaling algorithm that is "pixel-perfect" and could be made to
> be more fuzzy. Right now, it offers two scalers and could offer more.
>
> Within a particular rendering, mode-lambda can return a WxH sprite
> with some scaling applied (the #:mx and #:my parameters) and it again
> does it in a "pixel-perfect" way. This is a pretty deep assumption,
> but in principle could be changed.
>
> In normal 3D graphics engines, anti-aliasing is used because polygon
> edges (lines) do not even fall on pixel boundaries, so there are
> subtle techniques to figure how they line up well. Given that
> mode-lambda only renders rectangles and guarantees that within a layer
> every pixel comes from exactly one sprite, I think the normal things
> would apply less well. I think this is assumption of mode-lambda that
> you want changed so that a rotated sprite would combine its pixel
> value with the other sprite sharing a portion of the same location
> given that the ultimate rendering canvas would accommodate them?
>
> Jay
>
>
>
>
>
>
> On Mon, Nov 14, 2016 at 1:57 PM, David Vanderson
>  wrote:
> > I'm working on converting my game to use mode-lambda, and it's going
> pretty
> > well so far, but I'd like to get smoother rendering of sprites rotated &
> > scaled.
> >
> > I was hoping that (send gl-config set-multisample-size 4) would take
> care of
> > it.  That works for some raw opengl stuff I've tried, but not for
> > mode-lambda.
> >
> > Is there some switch I've missed?  Or does this need deeper changes to
> the
> > shaders?  I'm happy to dig into it but wanted to make sure I wasn't
> missing
> > something obvious.
> >
> > Thanks,
> > Dave
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Jay McCarthy
> Associate Professor
> PLT @ CS @ UMass Lowell
> http://jeapostrophe.github.io
>
>"Wherefore, be not weary in well-doing,
>   for ye are laying the foundation of a great work.
> And out of small things proceedeth that which is great."
>   - D 64:33
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ml-line.rkt
Description: Binary data


Re: [racket-users] mode-lambda with antialiasing?

2016-11-14 Thread Jay McCarthy
Hi David,

I know what anti-aliasing is, but I don't think I know how you mean it
to apply for mode-lambda.

mode-lambda renders a W1xH1 scene onto a W2xH2 canvas and by default
uses a scaling algorithm that is "pixel-perfect" and could be made to
be more fuzzy. Right now, it offers two scalers and could offer more.

Within a particular rendering, mode-lambda can return a WxH sprite
with some scaling applied (the #:mx and #:my parameters) and it again
does it in a "pixel-perfect" way. This is a pretty deep assumption,
but in principle could be changed.

In normal 3D graphics engines, anti-aliasing is used because polygon
edges (lines) do not even fall on pixel boundaries, so there are
subtle techniques to figure how they line up well. Given that
mode-lambda only renders rectangles and guarantees that within a layer
every pixel comes from exactly one sprite, I think the normal things
would apply less well. I think this is assumption of mode-lambda that
you want changed so that a rotated sprite would combine its pixel
value with the other sprite sharing a portion of the same location
given that the ultimate rendering canvas would accommodate them?

Jay






On Mon, Nov 14, 2016 at 1:57 PM, David Vanderson
 wrote:
> I'm working on converting my game to use mode-lambda, and it's going pretty
> well so far, but I'd like to get smoother rendering of sprites rotated &
> scaled.
>
> I was hoping that (send gl-config set-multisample-size 4) would take care of
> it.  That works for some raw opengl stuff I've tried, but not for
> mode-lambda.
>
> Is there some switch I've missed?  Or does this need deeper changes to the
> shaders?  I'm happy to dig into it but wanted to make sure I wasn't missing
> something obvious.
>
> Thanks,
> Dave
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] mode-lambda with antialiasing?

2016-11-14 Thread David Vanderson
I'm working on converting my game to use mode-lambda, and it's going pretty
well so far, but I'd like to get smoother rendering of sprites rotated &
scaled.

I was hoping that (send gl-config set-multisample-size 4) would take care
of it.  That works for some raw opengl stuff I've tried, but not for
mode-lambda.

Is there some switch I've missed?  Or does this need deeper changes to the
shaders?  I'm happy to dig into it but wanted to make sure I wasn't missing
something obvious.

Thanks,
Dave

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.