Texture filters

About Monkey 2 Forums Monkey 2 Programming Help Texture filters

This topic contains 17 replies, has 9 voices, and was last updated by  Diffrenzy 1 year, 10 months ago.

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #8326

    Hezkore
    Participant

    I just updated to the latest Monkey 2 dev build, and it seems TextureFilter is gone?
    I want scaled images to use GL_NEAREST, and I’ve tried TextureFlags.None and TextureFlags.Filter, but none of them have that effects.

    So how do I get my images nice and pixely?
    Do I have to use canvas.TextureFilteringEnabled=False just before I draw that image?

    #8346

    Mark Sibly
    Keymaster

    Yes, ripped this out for now while 3d stuff is being added.

    What are you wanting to do exactly? How were you using TextureFilter before?

    Canvas.TextureFilteringEnabled:Bool is back now, but that flushes rendering so isn’t particularly efficient (unless you sort Draw calls). It’s really meant for a quick ‘n’ dirty ‘retro mode’, which seemed to be what most people wanted.

    #8375

    Mark Sibly
    Keymaster

    Bump…would quite like a reply to this if possible!

    #8377

    cocon
    Participant

    From what I understand GL_NEAREST creates this pixelized effect, which is particularly good for retro styling.

    From my perspective it would be a much preferred way to produce this effect in a post processing shader. Because that way you don’t have to mess with the underlying engine configurations.

     

    #8378

    Mark Sibly
    Keymaster

    I’m more interested in how (and why) its being used.

    Canvas.TextureFilteringEnabled (which globally forces nearest filtering for all drawing) takes care of all the stuff in bananas and the framework stuff in modules – what else is needed on top of this?

    I’m guessing the ability to selectively enable nearest filtering for only some textures, in which case perhaps adding an optional textureFlags param (that includes texture filtering modes, as it used to!) to Image.Load would be enough?

    It’s hard to say what ‘best’ here (while also taking into account the new 3d stuff) unless I have an idea of what it’s being used for.

    #8380

    AdamStrange
    Participant

    I’m using this:

    ‘need this for pixels and not smoothed
    canvas.TextureFilteringEnabled = false

     

    It gives pixel graphics that have not been smoothed. so I can use (say a 16×16) graphic without it looking like crap at bigger resolutions.

    Also great for making games that want low res graphics for example:

    #8383

    Hezkore
    Participant

    I’m using this for my Voxel module.

    If I have filtering enabled, you can barely tell what the voxel objects are supposed to be since I’m stretching them so much.

    But with filtering off, it looks like good old voxel cubes.

    But now, since it’s a canvas option, everything is forced to be without filtering just because you’re using my Voxel module. Even text and stuff, which might look better with some filtering.

    I’d gladly take a loading flag for no filtering over forcing the entire canvas to be one specific thing.

    #8391

    Ethernaut
    Participant

    I’ve been using TextureFilter per image, instead of setting the canvas. I’m still on V1.1.04, though.

    #8401

    Diffrenzy
    Keymaster

    I’m thinking this is maybe relevant? : http://monkey2.monkey-x.com/forums/topic/texturemapping-wrap-with-drawprimitives/

    The feature request is: Let it be possiple to set the texture wrap flag at runtime, after loading.
    myimg.Textureflags(n,flags) or something…

    OR maybe specifying them when calling DrawPrimitives()?

    #8403

    therevills
    Participant

    With image filters set an the image level not the canvas level I guess we could create something like this:

    If anyone wants to mix retro we “modern”.

    #8404

    Mark Sibly
    Keymaster

    There is actually a simple way to modify texture flags currently in the develop branch – the Texture.Flags property is now read/write so you can actually just blast your own flags in, eg:

    image.Texture.Flags|=TextureFlags.WrapST    ‘enable texture coordinate wrapping.

    image.Texture.Flags&=~TextureFlags.FIlterMipmap   ‘disable filtering/mipmapping.

    This does actualy take care of all the above issues in a pretty clean way!

    Is everyone OK with this approach (and with TextureFilter being moved to TextureFlags)?

    #8405

    Hezkore
    Participant

    I’m fine with that Mark 🙂

    #8406

    AdamStrange
    Participant

    why not have both?

    #8407

    Ethernaut
    Participant

    Not using the dev branch yet, but this seems fine to me. Thanks.

    #8408

    AdamStrange
    Participant

    image.Texture.Flags|=TextureFlags.WrapST    ‘enable texture coordinate wrapping.

    image.Texture.Flags&=~TextureFlags.FIlterMipmap   ‘disable filtering/mipmapping.

    it’s a bit messy

    why not use your own system and wrap them up nicely in a property, E.G.

    image.Texture.TextureFilter = true/false

    image.Texture.WrapST = true/false

     

    This would make it a much more friendly approach

Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic.