[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-openjfx-dev
Subject: Re: [JavaFX 3D ( | Feature Request)] Setting Texture Nearest-Sampling on PhongMaterial
From: Nir Lisker <nlisker () gmail ! com>
Date: 2023-08-29 20:21:31
Message-ID: CA+0ynh-g4h6x1t+UdcriPegYPEQypGrC4ipKrLLqUzh3YTZ9hA () mail ! gmail ! com
[Download RAW message or body]
I managed to hack my way through the D3D pipeline and set the filters when
the maps are loaded into the material. Took screenshots:
https://imgur.com/YAzkrxP
https://imgur.com/SMlWqTr
I will need to do some more work to wire it properly, but conceptually it
works. We also need to finalize the API and hook up OpenGL. Not sure what
the situation in Metal is.
On Sun, Aug 27, 2023 at 1:15 PM Nir Lisker <nlisker@gmail.com> wrote:
> Thanks for the ideas,
>
> > Could you subclass Image? I'm not that well versed with Textures in
> > modern gfx systems, but I do know that a texture is often just a tileable
> > image, so subclassing image seems to be an option. In other words, if a
> > Texture always satisfies "is-an-image", a subclass seems reasonable.
> >
> Subclassing Image has the following problems: On the user side, there is
> no indication other than writing in the docs that the image should be of
> that subtype. On our side, it would mean that we need to make an instanceof
> check to see which type of Image was used. I'm mostly concerned with the
> former, "we accept any Image, but you should use this subclass" isn't good
> design IMO.
>
> Alternatively, perhaps Image and Texture could implement some interface,
> > and the currently public API could change to that interface type.
> >
>
> If this is backwards compatible it could also be an option. It has the
> same issues above, but forces the user to make a conscious decision about
> which type is chosen.
>
> Are mipmapped textures commonly provided as multiple images, or are the
> > smaller images just scaled down versions that could be (pre)calculated from
> > the main texture image?
>
>
> Both. You can either give your own set of scaled down images, or have them
> be generated for you by the graphics pipeline. Right now the implementation
> is partially set for mipmaps (there is a flag saying if they should be used
> or not), but at the end they are not used. I didn't review the capabilities
> of all the pipelines there yet.
>
>
> > Another option may again be to subclass Image, as a mipmapped texture is
> > mostly just scaled versions of the same image, providing the highest
> > quality image for the normal Image API would be fine, and having extra API
> > in the subclass to get access to pre-scaled mip mapped versions is not
> > unreasonable.
>
>
> This is more or less part of the plan I outlined. The "main" image is
> always the largest one. Then I suggested a List<Image> (in whichever class
> ends up holding the texture data) for the downscaled ones.
>
> A TextureData class or a 'TextureImage extends Image' class (or whatever
> is chosen) would contain something like:
>
> MinMagFilter minFilter; // enum with NEAREST, LINEAR
> MinMagFilter magFilter; // enum with NEAREST, LINEAR
> MipFilter mipFilter; // enum with NEAREST, LINEAR
>
> float anisotropyStrength;
>
> List<Image> mipMaps;
>
> WrapMode wrapMode; // enum with wrap modes like REPEAT, CLAMP... this
> exists in some form already
>
> etc.
>
>
> On Sun, Aug 27, 2023 at 6:45 AM John Hendrikx <john.hendrikx@gmail.com>
> wrote:
>
> > Hi Nir,
> >
> > I added some inline questions/comments for your consideration.
> >
> > --John
> > On 26/08/2023 00:17, Nir Lisker wrote:
> >
> > I've done a preliminary study and assessment for changes in regards to
> > textures.
> >
> > Texture metadata (addressing, filtering, wrapping, blending...) is
> > supported by both OpenGL and D3D in a similar enough way that makes a
> > uniform API possible and not convoluted. This metadata can be added to
> > Texture, or perhaps better, TextureMap.
> > Unfortunately, there is no ideal way of creating the public API because
> > the textures in PhongMaterial are represented as Images. Interestingly,
> > there are comments on the map properties in PhongMaterial that touch on
> > this, "// TODO: 3D - Texture or Image? For Media it might be better to have
> > it as a Texture", but I think that the question didn't get resolved in time
> > and Image stayed.
> >
> > Because we can't change the type, we have the following options:
> > 1. Duplicate the methods in PhongMaterial that use ObjectProperty<Image>
> > and have a set that uses ObjectProperty<Texture> (or TextureMap) with it
> > taking precedence. I think that this is a bad option as it creates API
> > noise and is confusing to use.
> > 2. Add the metadata to Image and enhance its public API. I don't think
> > that this is a good option either because it will bloat Image with specific
> > data that is not widely used.
> >
> > Could you subclass Image? I'm not that well versed with Textures in
> > modern gfx systems, but I do know that a texture is often just a tileable
> > image, so subclassing image seems to be an option. In other words, if a
> > Texture always satisfies "is-an-image", a subclass seems reasonable.
> >
> > Alternatively, perhaps Image and Texture could implement some interface,
> > and the currently public API could change to that interface type.
> >
> >
> > 3. Create a new Material, placeholder name PhongMaterial2, that uses
> > textures instead. We might want to look at other breaking enhancements for
> > PhongMaterial so we can plan ahead better this time. I think that this is a
> > reasonable option whose eligibility depends on how much we can't update the
> > current PhongMaterial. Mipmaping, which requires a set of images, might be
> > one of them.
> >
> > Are mipmapped textures commonly provided as multiple images, or are the
> > smaller images just scaled down versions that could be (pre)calculated from
> > the main texture image?
> >
> > Another option may again be to subclass Image, as a mipmapped texture is
> > mostly just scaled versions of the same image, providing the highest
> > quality image for the normal Image API would be fine, and having extra API
> > in the subclass to get access to pre-scaled mip mapped versions is not
> > unreasonable.
> >
> > 4. Create a separate set of methods inside PhongMaterial that deal with
> > the texture metadata only. These will be something like
> > `ObjectProperty<TextureData> diffuseTextureDataProperty()` and similarly
> > for the other maps. I think that this option is also reasonable, although
> > it also creates API noise (these only take effect if the maps are used to
> > begin with).
> >
> > I didn't look deeply into texture aspects outside of the discussed
> > filtering, but I think we should take the opportunity to do so. For
> > filtering, I have the following ideas:
> >
> > For min/mag filters: an enum with NEAREST (nearest-point/neighbor
> > sampling) and LINEAR ((bi)linear sampling).
> > For mipmap filters: an enum with NEAREST (nearest mipmap level) and
> > LINEAR (linear interpolation between levels). While some APIs have a NONE
> > mode to disable mipmaping, the inexistence of mipmaps can be used as a
> > disabled mode.
> > Even though they use the same constant names, the meaning is different,
> > so I think the enums should be separate.
> >
> > For mipmaps: a List<Image>. Autogeneration of mipmaps can also be
> > considered.
> >
> > Anisotropy is supported in D3D via a filter type (ANISOTROPIC) plus a
> > strength factor, and in OpenGL since version 4.6 (which version does JavaFX
> > use?). Metal and Vulkan just use a strength factor to turn it on regardless
> > of the filter. I think that this is a more flexible approach and we could
> > add a single int/double property to control anisotropy.
> >
> > References:
> > Metal specs [1] (section 2.10)
> > Vulkan specs [2] (Section 16.8.3)
> > D3D docs [3][4][5]
> > OpenGL (external resource) [6][7]
> >
> > [1]
> > https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf
> > [2]
> > https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html
> > [3]
> > https://learn.microsoft.com/en-us/windows/win32/direct3d9/texture-filtering
> > [4]
> > https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dtexturefiltertype
> > [5]
> > https://learn.microsoft.com/en-us/windows/win32/api/d3d9helper/nf-d3d9helper-idirect3ddevice9-setsamplerstate
> > [6] https://learnopengl.com/Getting-started/Textures
> > [7]
> > https://gregs-blog.com/2008/01/17/opengl-texture-filter-parameters-explained/
> >
> > On Sun, Jun 25, 2023 at 9:03 PM Nir Lisker <nlisker@gmail.com> wrote:
> >
> > > Perhaps Jay and Kevin can weigh in on this.
> > >
> > > By the way, I see that the com.sun.prism.Texture interface already
> > > defines get/setLinearFiltering methods that specify if the filtering is not
> > > linear then it uses a nearest neighbor algorithm. It's not used by the 3D
> > > side it seems.
> > >
> > > On Sun, Jun 25, 2023 at 8:54 PM Matija Brown <Matija.Brown@outlook.de>
> > > wrote:
> > >
> > > > This is a good point you're bringing up Nir!
> > > >
> > > >
> > > >
> > > > I'm really not sure on that. On the one hand your interpretation seems
> > > > the most sensible, but on the other hand I can't see any use case of
> > > > NEAREST filtering in specular or self-illumination maps.
> > > >
> > > > However giving more options is also always good, and the same way there
> > > > aren't really many places (that I'm aware of) one would have NEAREST
> > > > filtered diffuse maps and use any of the others at all.
> > > >
> > > >
> > > >
> > > > TLDL: Would work excellently your way API wise, but I'm not certain if
> > > > it makes sense use-case wise.
> > > >
> > > >
> > > >
> > > > Thanks,
> > > >
> > > > Matija.
> > > >
> > > >
> > > >
> > > > *From: *Nir Lisker <nlisker@gmail.com>
> > > > *Sent: *Sunday, 25 June 2023 19:49
> > > > *To: *Matija Brown <Matija.Brown@outlook.de>
> > > > *Cc: *Jayathirth Rao Daarapuram Venkatesh Murthy
> > > > <jayathirth.d.v@oracle.com>; Kevin Rushforth
> > > > <kevin.rushforth@oracle.com>; openjfx-dev@openjdk.org
> > > > *Subject: *Re: [JavaFX 3D ( | Feature Request)] Setting Texture
> > > > Nearest-Sampling on PhongMaterial
> > > >
> > > >
> > > >
> > > > I think that the first question to answer is whether the filtering
> > > > method is applied to all maps/textures of the material (diffuse, specular,
> > > > self-illumination) or to each individually. I would imagine that the former
> > > > makes more sense. If that's the case, the texture filtering parameter will
> > > > be just one more property in PhongMaterial (perhaps in the Material
> > > > supertype if it also makes sense for other possible materials - that can be
> > > > figured out later in any case).
> > > >
> > > >
> > > >
> > > > On Sun, Jun 25, 2023 at 3:20 PM Matija Brown <Matija.Brown@outlook.de>
> > > > wrote:
> > > >
> > > > Unfortunately it took a little longer (got busy), but have just had a
> > > > quick look at the
> > > >
> > > > OpenGL side of things.
> > > >
> > > >
> > > >
> > > > The ES2Texture class appears to handle everything there. There are two
> > > > create-Methods, but the other
> > > >
> > > > one is responsible for MediaFrame stuff and it doesn't really? make
> > > > sense to have non-linear filtering there?
> > > >
> > > > What's your opinion?
> > > >
> > > >
> > > >
> > > > The create method seems to parse in all texture parameters simply as
> > > > arguments (
> > > > https://github.com/openjdk/jfx/blob/0d9dcf38275528e1b621d71631aac5bdb9452110/modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2Texture.java#L98
> > > > ),
> > > >
> > > > it would probably be best to just add the filtering in there as well.
> > > >
> > > >
> > > >
> > > > API-wise it's probably best to have a Texture or DiffuseMap class that
> > > > the PhongMaterial uses and stores metadata about the Image.
> > > >
> > > > However this might be slightly overkill considering there is only this
> > > > one single parameter we're trying to add,
> > > >
> > > > thus maybe just a flag in PhongMaterial would suffice?
> > > >
> > > >
> > > >
> > > > Have a nice day,
> > > >
> > > > Matija.
> > > >
> > > > *From: *Matija Brown <Matija.Brown@outlook.de>
> > > > *Sent: *Thursday, 22 June 2023 18:37
> > > > *To: *Jayathirth Rao Daarapuram Venkatesh Murthy
> > > > <jayathirth.d.v@oracle.com>; Nir Lisker <nlisker@gmail.com>; Kevin
> > > > Rushforth <kevin.rushforth@oracle.com>
> > > > *Cc: *openjfx-dev@openjdk.org
> > > > *Subject: *RE: [JavaFX 3D ( | Feature Request)] Setting Texture
> > > > Nearest-Sampling on PhongMaterial
> > > >
> > > >
> > > >
> > > > I'll do the OpenGL – have done quite a bit with Vulkan and GL in the
> > > > past so there's no problem there.
> > > >
> > > > Certainly usefull if you would do some reviewing – if you finish the
> > > > Metal texture maps someone will surely find
> > > >
> > > > themselves to expand it with sampling.
> > > >
> > > >
> > > >
> > > > Tomorrow I'll give a short summary on what would be to do for OpenGL,
> > > > as we have that for D3D already.
> > > >
> > > > Then do a little example probably – doesn't really seem too much work
> > > > to me?
> > > >
> > > >
> > > >
> > > > Thanks,
> > > >
> > > > Matija.
> > > >
> > > >
> > > >
> > > > *From: *Jayathirth Rao Daarapuram Venkatesh Murthy
> > > > <jayathirth.d.v@oracle.com>
> > > > *Sent: *Thursday, 22 June 2023 06:28
> > > > *To: *Nir Lisker <nlisker@gmail.com>; Kevin Rushforth
> > > > <kevin.rushforth@oracle.com>
> > > > *Cc: *openjfx-dev@openjdk.org
> > > > *Subject: *Re: [JavaFX 3D ( | Feature Request)] Setting Texture
> > > > Nearest-Sampling on PhongMaterial
> > > >
> > > >
> > > >
> > > > Correcting myself:
> > > >
> > > > Currently I am working on Metal implementation of Texture maps in
> > > > JavaFX 3D : https://bugs.openjdk.org/browse/JDK-8310109 and not on
> > > > adding nearest sampling(which last mail can imply).
> > > >
> > > >
> > > >
> > > > Thanks,
> > > >
> > > > Jay
> > > >
> > > >
> > > >
> > > > *From: *openjfx-dev <openjfx-dev-retn@openjdk.org> on behalf of
> > > > Jayathirth Rao Daarapuram Venkatesh Murthy <jayathirth.d.v@oracle.com>
> > > > *Date: *Thursday, 22 June 2023 at 9:22 AM
> > > > *To: *Nir Lisker <nlisker@gmail.com>, Kevin Rushforth <
> > > > kevin.rushforth@oracle.com>
> > > > *Cc: *openjfx-dev@openjdk.org <openjfx-dev@openjdk.org>
> > > > *Subject: *Re: [JavaFX 3D ( | Feature Request)] Setting Texture
> > > > Nearest-Sampling on PhongMaterial
> > > >
> > > > Currently I am working on Metal implementation of the same and has no
> > > > bandwidth to work on additional OpenGL thing.
> > > >
> > > > But I can help in reviewing the code if we come up with addition of
> > > > nearest filtering.
> > > >
> > > >
> > > >
> > > > Thanks,
> > > >
> > > > Jay
> > > >
> > > >
> > > >
> > > > *From: *openjfx-dev <openjfx-dev-retn@openjdk.org> on behalf of Nir
> > > > Lisker <nlisker@gmail.com>
> > > > *Date: *Wednesday, 21 June 2023 at 9:40 PM
> > > > *To: *Kevin Rushforth <kevin.rushforth@oracle.com>
> > > > *Cc: *openjfx-dev@openjdk.org <openjfx-dev@openjdk.org>
> > > > *Subject: *Re: [JavaFX 3D ( | Feature Request)] Setting Texture
> > > > Nearest-Sampling on PhongMaterial
> > > >
> > > > If I remember correctly, in OpenGL you parse the texture filter when
> > > > the texture is being created, while in DirectX as it is bound
> > > >
> > > > to the sampler (it is a sampler state after all) it would have to be
> > > > set before every render call. However it shouldn't make any
> > > >
> > > > API difference really, as we can just have a field somewhere and the
> > > > parse it along when needed.
> > > >
> > > >
> > > >
> > > > Yes, the JBS ticket mentions this difference as well.
> > > >
> > > >
> > > >
> > > > Since Kevin approved this feature and the API seems to converge nicely
> > > > between the pipelines, we can start the work. I'm somewhat busy with other
> > > > tasks as of late, but I will try to formulate an API. Matija or Jay, if one
> > > > of you can start investigating the changes to the OpenGL pipeline we could
> > > > create a branch in the sandbox repo and work there.
> > > >
> > > >
> > > >
> > > > On Wed, Jun 21, 2023 at 4:03 PM Kevin Rushforth <
> > > > kevin.rushforth@oracle.com> wrote:
> > > >
> > > > My preference would be to add support only for Linear and Nearest in
> > > > any case.
> > > >
> > > > -- Kevin
> > > >
> > > > On 6/21/2023 4:48 AM, Matija Brown wrote:
> > > >
> > > > As Jayathrith said, in OpenGL as well as Metal only NEAREST and LINEAR
> > > > filters are available.
> > > >
> > > >
> > > >
> > > > There might be a way of getting around it by implementing some own
> > > > algorithm for OpenGL and Metal but that seem slightly
> > > >
> > > > over the top. So either one would have to keep the options limited to
> > > > the two supported everywhere
> > > >
> > > > or go with the "conditional" features.
> > > >
> > > >
> > > >
> > > > Having had a look at DirectX the APIs seem not to differ too much.
> > > >
> > > > If I remember correctly, in OpenGL you parse the texture filter when
> > > > the texture is being created, while in DirectX as it is bound
> > > >
> > > > to the sampler (it is a sampler state after all) it would have to be
> > > > set before every render call. However it shouldn't make any
> > > >
> > > > API difference really, as we can just have a field somewhere and the
> > > > parse it along when needed.
> > > >
> > > >
> > > >
> > > > Cheers,
> > > >
> > > > Matija.
> > > >
> > > >
> > > >
> > > > *From: *Jayathirth Rao Daarapuram Venkatesh Murthy
> > > > <jayathirth.d.v@oracle.com>
> > > > *Sent: *Wednesday, 21 June 2023 13:09
> > > > *To: *Nir Lisker <nlisker@gmail.com>; Matija Brown
> > > > <Matija.Brown@outlook.de>
> > > > *Cc: *openjfx-dev@openjdk.org
> > > > *Subject: *Re: [JavaFX 3D ( | Feature Request)] Setting Texture
> > > > Nearest-Sampling on PhongMaterial
> > > >
> > > >
> > > >
> > > > In OpenGL we set GL_LINEAR by default at :
> > > > https://github.com/openjdk/jfx/blob/0d9dcf38275528e1b621d71631aac5bdb9452110/modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2Texture.java#L221
> > > >
> > > >
> > > >
> > > > And Metal supports only two types of Min/Max filters : Nearest(default)
> > > > and Linear. So even if D3D supports multiple types we might be limited to
> > > > support only these 2 filters for all platforms.
> > > >
> > > >
> > > >
> > > > Thanks,
> > > >
> > > > Jay
> > > >
> > > >
> > > >
> > > > *From: *openjfx-dev <openjfx-dev-retn@openjdk.org>
> > > > <openjfx-dev-retn@openjdk.org> on behalf of Nir Lisker
> > > > <nlisker@gmail.com> <nlisker@gmail.com>
> > > > *Date: *Wednesday, 21 June 2023 at 3:57 PM
> > > > *To: *Matija Brown <Matija.Brown@outlook.de> <Matija.Brown@outlook.de>
> > > > *Cc: *openjfx-dev@openjdk.org <openjfx-dev@openjdk.org>
> > > > <openjfx-dev@openjdk.org>
> > > > *Subject: *Re: [JavaFX 3D ( | Feature Request)] Setting Texture
> > > > Nearest-Sampling on PhongMaterial
> > > >
> > > > First of all, please excuse directly e-mailing you earlier today.
> > > > Working with mailing lists is quite new for me and apparently I forgot to
> > > > add
> > > >
> > > > the mailing list to cc.
> > > >
> > > >
> > > >
> > > > I didn't get any private email, so you seem to be doing better than you
> > > > thought with the mailing list :)
> > > >
> > > >
> > > >
> > > > With the OpenGL-side I do have some experience. Concerning the D3D-side
> > > > of things it would probably mean convincing
> > > >
> > > > Somebody that it is a good idea to finally apply the suggested change.
> > > >
> > > >
> > > >
> > > > There would be some API change required of course. As a basic concept
> > > > it would probably be sensible to add this as a parameter to the
> > > > PhonMaterial-class.
> > > >
> > > > Alternatively it might make sense to add a "Texture" class that is used
> > > > a a DiffuseMap in the PhonMaterial. But that seems slightly overkill.
> > > >
> > > >
> > > >
> > > > Where to put the new methods in the Java side is not the
> > > > concerning part, it's how to create methods that match all the pipelines.
> > > > In D3D, the method for setting the filter is detailed in [1], and its
> > > > possible parameters in [2][3][4]. So suppose that I'm looking at the list
> > > > of available filter types there:
> > > >
> > > > D3DTEXF_NONE, D3DTEXF_POINT, D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC,
> > > > D3DTEXF_PYRAMIDALQUAD, D3DTEXF_GAUSSIANQUAD, D3DTEXF_CONVOLUTIONMONO,
> > > >
> > > > if OpenGL supports a somewhat different set of filters, we will have
> > > > some clashes in the Java API side.
> > > >
> > > >
> > > >
> > > > Generally, we would like to give as much flexibility to the user as
> > > > possible, but need to be careful with platform-specific functionality. We
> > > > could round *some* corners. For example, I think that if we have an enum
> > > > for the filter types above that is a union of the ones available in the
> > > > different pipelines, and if a few are supported by only one of the
> > > > pipelines, we could note it in the docs and get away with it (something
> > > > similar to a conditional feature). However, if the whole native pipeline
> > > > setup for texture filtering is different, which means a different set of
> > > > Java API methods per pipeline, then that's too much.
> > > >
> > > >
> > > >
> > > > All this means is that to continue we need to figure out what the API
> > > > for each pipeline looks like, what's the most functionality we can have for
> > > > each pipeline, and then how we can unite them into a single Java API with
> > > > the hopes of being able to reconcile the differences "well enough"
> > > > (whatever that will mean).
> > > >
> > > >
> > > >
> > > > [1]
> > > > https://learn.microsoft.com/en-us/windows/win32/api/d3d9helper/nf-d3d9helper-idirect3ddevice9-setsamplerstate
> > > >
> > > > [2]
> > > > https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dtexturefiltertype
> > > >
> > > > [3]
> > > > https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype
> > > >
> > > > [4]
> > > > https://learn.microsoft.com/en-us/windows/win32/direct3d9/vertex-textures-in-vs-3-0
> > > >
> > > >
> > > >
> > > > On Wed, Jun 21, 2023 at 12:45 PM Matija Brown <Matija.Brown@outlook.de>
> > > > wrote:
> > > >
> > > > First of all, please excuse directly e-mailing you earlier today.
> > > > Working with mailing lists is quite new for me and apparently I forgot to
> > > > add
> > > >
> > > > the mailing list to cc.
> > > >
> > > >
> > > >
> > > > With the OpenGL-side I do have some experience. Concerning the D3D-side
> > > > of things it would probably mean convincing
> > > >
> > > > Somebody that it is a good idea to finally apply the suggested change.
> > > >
> > > >
> > > >
> > > > There would be some API change required of course. As a basic concept
> > > > it would probably be sensible to add this as a parameter to the
> > > > PhonMaterial-class.
> > > >
> > > > Alternatively it might make sense to add a "Texture" class that is used
> > > > a a DiffuseMap in the PhonMaterial. But that seems slightly overkill.
> > > >
> > > >
> > > >
> > > > As I am not very well acquainted with current design principles of this
> > > > library, these things should lie in more experience contributors hands.
> > > >
> > > >
> > > >
> > > > *From: *Nir Lisker <nlisker@gmail.com>
> > > > *Sent: *Tuesday, 20 June 2023 20:50
> > > > *To: *Matija Brown <Matija.Brown@outlook.de>
> > > > *Cc: *openjfx-dev@openjdk.org
> > > > *Subject: *Re: [JavaFX 3D ( | Feature Request)] Setting Texture
> > > > Nearest-Sampling on PhongMaterial
> > > >
> > > >
> > > >
> > > > Which leads to the question; Does there, in JavaFX exist something
> > > > comparable to setting the texture-sampler to NEAREST
> > > >
> > > > instead of LINEAR sampling?
> > > >
> > > >
> > > >
> > > > There is no API to set the texture filter. If you would like to
> > > > contribute and add it, I can help. It needs to be compatible with both
> > > > Direct3D and OpenGL (not sure how the work on Metal is going), so this can
> > > > be a challenge.
> > > >
> > > >
> > > >
> > > > For the D3D side, see this issue in JBS [1]. The relevant code is at
> > > > [2]. I didn't look at the OpenGL side.
> > > >
> > > >
> > > >
> > > > - Nir
> > > >
> > > >
> > > >
> > > > [1] https://bugs.openjdk.org/browse/JDK-8092272
> > > >
> > > > [2]
> > > > https://github.com/openjdk/jfx/blob/0d9dcf38275528e1b621d71631aac5bdb9452110/modules/javafx.graphics/src/main/native-prism-d3d/D3DContext.cc#L621
> > > >
> > > >
> > > >
> > > > On Mon, Jun 19, 2023 at 10:15 PM Matija Brown <Matija.Brown@outlook.de>
> > > > wrote:
> > > >
> > > > On my never ending journey of building a Minecraft-clone in every
> > > > graphics-framework available,
> > > >
> > > > I have come across JavaFX for the next attempt.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > However a minor inconvenience has crossed my path in the process:
> > > >
> > > >
> > > >
> > > > Using the (very well developed!) 2D-Graphics displaying pixel-art style
> > > > images is no trouble whatsoever.
> > > >
> > > > Simply rendering it to a canvas and disabling smoothing does the job
> > > > just fine. Unfortunately, I have been
> > > >
> > > > unable to figure out how to achieve a similar thing using the
> > > > 3D-Graphics engine and the PhongMaterial that comes with it.
> > > >
> > > >
> > > >
> > > > Which leads to the question; Does there, in JavaFX exist something
> > > > comparable to setting the texture-sampler to NEAREST
> > > >
> > > > instead of LINEAR sampling?
> > > >
> > > > Unfortunately the latest information I could find online was from about
> > > > 2013 and much has (probably)
> > > >
> > > > changed since then. Thus the question is being posed once again.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I whish to excuse myself for probably repeating a fairly common
> > > > question,
> > > >
> > > >
> > > >
> > > > Kind regards,
> > > > Matija Brown.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
[Attachment #3 (text/html)]
<div dir="ltr">I managed to hack my way through the D3D pipeline and set the filters \
when the maps are loaded into the material. Took screenshots:<div><a \
href="https://imgur.com/YAzkrxP">https://imgur.com/YAzkrxP</a><br><a \
href="https://imgur.com/SMlWqTr">https://imgur.com/SMlWqTr</a><br><div><span \
style="--darkreader-inline-bgcolor: #25282a;"> </span></div></div><div><br></div>I \
will need to do some more work to wire it properly, but conceptually it works. We \
also need to finalize the API and hook up OpenGL. Not sure what the situation in \
Metal is.<div><br></div></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Sun, Aug 27, 2023 at 1:15 PM Nir Lisker <<a \
href="mailto:nlisker@gmail.com">nlisker@gmail.com</a>> wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thanks for the ideas, \
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex"><p>Could you subclass Image? I'm not \
that well versed with Textures in modern gfx systems, but I do know that a texture is \
often just a tileable image, so subclassing image seems to be an option. In other \
words, if a Texture always satisfies "is-an-image", a subclass seems \
reasonable.</p></blockquote><div>Subclassing Image has the following problems: On the \
user side, there is no indication other than writing in the docs that the image \
should be of that subtype. On our side, it would mean that we need to make an \
instanceof check to see which type of Image was used. I'm mostly concerned with \
the former, "we accept any Image, but you should use this subclass" \
isn't good design IMO.</div><div><br></div><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">Alternatively, perhaps Image and Texture could \
implement some interface, and the currently public API could change to that interface \
type.<br></blockquote><div><br></div><div>If this is backwards compatible it could \
also be an option. It has the same issues above, but forces the user to make a \
conscious decision about which type is chosen.</div><div><br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">Are mipmapped textures commonly provided as \
multiple images, or are the smaller images just scaled down versions that could be \
(pre)calculated from the main texture image?</blockquote><div><br></div><div>Both. \
You can either give your own set of scaled down images, or have them be generated for \
you by the graphics pipeline. Right now the implementation is partially set for \
mipmaps (there is a flag saying if they should be used or not), but at the end they \
are not used. I didn't review the capabilities of all the pipelines there \
yet.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Another option may \
again be to subclass Image, as a mipmapped texture is mostly just scaled versions of \
the same image, providing the highest quality image for the normal Image API would be \
fine, and having extra API in the subclass to get access to pre-scaled mip mapped \
versions is not unreasonable.</blockquote><div><br></div><div>This is more or less \
part of the plan I outlined. The "main" image is always the largest one. \
Then I suggested a List<Image> (in whichever class ends up holding the texture \
data) for the downscaled ones.</div><div><br></div><div>A TextureData class or a \
'TextureImage extends Image' class (or whatever is chosen) would contain \
something like:</div><div><br></div><div>MinMagFilter minFilter; // enum with \
NEAREST, LINEAR</div><div>MinMagFilter magFilter; // enum with NEAREST, \
LINEAR<br></div><div>MipFilter mipFilter; // enum with NEAREST, \
LINEAR</div><div><br></div><div>float \
anisotropyStrength;</div><div><br></div><div>List<Image> \
mipMaps;</div><div><br></div><div>WrapMode wrapMode; // enum with wrap modes like \
REPEAT, CLAMP... this exists in some form \
already</div><div><br></div><div>etc.</div><br></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Aug 27, 2023 at \
6:45 AM John Hendrikx <<a href="mailto:john.hendrikx@gmail.com" \
target="_blank">john.hendrikx@gmail.com</a>> wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">
<div>
<p>Hi Nir,</p>
<p>I added some inline questions/comments for your consideration.</p>
<p>--John<br>
</p>
<div>On 26/08/2023 00:17, Nir Lisker wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">I've done a preliminary study and assessment for
changes in regards to textures.
<div><br>
</div>
<div>Texture metadata (addressing, filtering, wrapping,
blending...) is supported by both OpenGL and D3D in a similar
enough way that makes a uniform API possible and not
convoluted. This metadata can be added to Texture, or perhaps
better, TextureMap.</div>
<div>Unfortunately, there is no ideal way of creating the public
API because the textures in PhongMaterial are represented as
Images. Interestingly, there are comments on the map
properties in PhongMaterial that touch on this, "// TODO: 3D -
Texture or Image? For Media it might be better to have it as a
Texture", but I think that the question didn't get resolved in
time and Image stayed.</div>
<div><br>
</div>
<div>Because we can't change the type, we have the following
options:</div>
<div>1. Duplicate the methods in PhongMaterial that use
ObjectProperty<Image> and have a set that uses
ObjectProperty<Texture> (or TextureMap) with it taking
precedence. I think that this is a bad option as it creates
API noise and is confusing to use.</div>
<div>2. Add the metadata to Image and enhance its public API. I
don't think that this is a good option either because it will
bloat Image with specific data that is not widely used.</div>
</div>
</blockquote>
<p>Could you subclass Image? I'm not that well versed with Textures
in modern gfx systems, but I do know that a texture is often just
a tileable image, so subclassing image seems to be an option. In
other words, if a Texture always satisfies "is-an-image", a
subclass seems reasonable.<br>
</p>
<p>Alternatively, perhaps Image and Texture could implement some
interface, and the currently public API could change to that
interface type.<br>
</p>
<p><br>
</p>
<blockquote type="cite">
<div dir="ltr">
<div>3. Create a new Material, placeholder name PhongMaterial2,
that uses textures instead. We might want to look at other
breaking enhancements for PhongMaterial so we can plan ahead
better this time. I think that this is a reasonable option
whose eligibility depends on how much we can't update the
current PhongMaterial. Mipmaping, which requires a set of
images, might be one of them.</div>
</div>
</blockquote>
<p>Are mipmapped textures commonly provided as multiple images, or
are the smaller images just scaled down versions that could be
(pre)calculated from the main texture image?</p>
<p>Another option may again be to subclass Image, as a mipmapped
texture is mostly just scaled versions of the same image,
providing the highest quality image for the normal Image API would
be fine, and having extra API in the subclass to get access to
pre-scaled mip mapped versions is not unreasonable.<br>
</p>
<blockquote type="cite">
<div dir="ltr">
<div>4. Create a separate set of methods inside PhongMaterial
that deal with the texture metadata only. These will be
something like `ObjectProperty<TextureData>
diffuseTextureDataProperty()` and similarly for the other
maps. I think that this option is also reasonable, although it
also creates API noise (these only take effect if the maps are
used to begin with).</div>
<div><br>
</div>
<div>I didn't look deeply into texture aspects outside of the
discussed filtering, but I think we should take the
opportunity to do so. For filtering, I have the following
ideas:</div>
<div><br>
</div>
<div>For min/mag filters: an enum with NEAREST
(nearest-point/neighbor sampling) and LINEAR ((bi)linear
sampling).<br>
</div>
<div>For mipmap filters: an enum with NEAREST (nearest mipmap
level) and LINEAR (linear interpolation between levels). While
some APIs have a NONE mode to disable mipmaping, the
inexistence of mipmaps can be used as a disabled mode.</div>
<div>Even though they use the same constant names, the meaning
is different, so I think the enums should be separate.</div>
<div><br>
</div>
<div>For mipmaps: a List<Image>. Autogeneration of mipmaps
can also be considered.</div>
<div><br>
</div>
<div>Anisotropy is supported in D3D via a filter type
(ANISOTROPIC) plus a strength factor, and in OpenGL since
version 4.6 (which version does JavaFX use?). Metal and Vulkan
just use a strength factor to turn it on regardless of the
filter. I think that this is a more flexible approach and we
could add a single int/double property to control anisotropy.</div>
<div><br>
</div>
<div>
<div>References:</div>
<div>
<div>Metal specs [1] (section 2.10)</div>
<div>Vulkan specs [2] (Section 16.8.3)</div>
<div>D3D docs [3][4][5]</div>
<div>OpenGL (external resource) [6][7]</div>
</div>
</div>
<div><br>
</div>
<div>[1] <a \
href="https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf" \
target="_blank">https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf</a></div>
<div>[2] <a href="https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html" \
target="_blank">https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html</a></div>
<div>[3] <a href="https://learn.microsoft.com/en-us/windows/win32/direct3d9/texture-filtering" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/direct3d9/texture-filtering</a></div>
<div>[4] <a href="https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dtexturefiltertype" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dtexturefiltertype</a></div>
<div>[5] <a href="https://learn.microsoft.com/en-us/windows/win32/api/d3d9helper/nf-d3d9helper-idirect3ddevice9-setsamplerstate" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/api/d3d9helper/nf-d3d9helper-idirect3ddevice9-setsamplerstate</a></div>
<div>[6] <a href="https://learnopengl.com/Getting-started/Textures" \
target="_blank">https://learnopengl.com/Getting-started/Textures</a></div> <div>[7] \
<a href="https://gregs-blog.com/2008/01/17/opengl-texture-filter-parameters-explained/" \
target="_blank">https://gregs-blog.com/2008/01/17/opengl-texture-filter-parameters-explained/</a></div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Jun 25, 2023 at
9:03 PM Nir Lisker <<a href="mailto:nlisker@gmail.com" \
target="_blank">nlisker@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div \
dir="ltr">Perhaps Jay and Kevin can weigh in on this. <div><br>
</div>
<div>By the way, I see that the com.sun.prism.Texture
interface already defines get/setLinearFiltering methods
that specify if the filtering is not linear then it uses a
nearest neighbor algorithm. It's not used by the 3D side
it seems.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Jun 25, 2023 at
8:54 PM Matija Brown <<a href="mailto:Matija.Brown@outlook.de" \
target="_blank">Matija.Brown@outlook.de</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div>
<div lang="en-DE">
<div>
<p class="MsoNormal">This is a good point you're
bringing up Nir!</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I'm really not sure on that. On
the one hand your interpretation seems the most
sensible, but on the other hand I can't see any
use case of NEAREST filtering in specular or
self-illumination maps.</p>
<p class="MsoNormal">However giving more options is
also always good, and the same way there aren't
really many places (that I'm aware of) one would
have NEAREST filtered diffuse maps and use any of
the others at all.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">TLDL: Would work excellently
your way API wise, but I'm not certain if it makes
sense use-case wise.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks,</p>
<p class="MsoNormal">Matija.</p>
<p class="MsoNormal"> </p>
<div \
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid \
rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="border:none;padding:0cm"><b>From: \
</b><a href="mailto:nlisker@gmail.com" target="_blank">Nir Lisker</a><br>
<b>Sent: </b>Sunday, 25 June 2023 19:49<br>
<b>To: </b><a href="mailto:Matija.Brown@outlook.de" \
target="_blank">Matija Brown</a><br>
<b>Cc: </b><a href="mailto:jayathirth.d.v@oracle.com" \
target="_blank">Jayathirth Rao Daarapuram Venkatesh Murthy</a>;
<a href="mailto:kevin.rushforth@oracle.com" \
target="_blank">Kevin
Rushforth</a>; <a href="mailto:openjfx-dev@openjdk.org" \
target="_blank"> openjfx-dev@openjdk.org</a><br>
<b>Subject: </b>Re: [JavaFX 3D ( | Feature
Request)] Setting Texture Nearest-Sampling on
PhongMaterial</p>
</div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal">I think that the first
question to answer is whether the filtering
method is applied to all maps/textures of the
material (diffuse, specular, self-illumination)
or to each individually. I would imagine that
the former makes more sense. If that's the case,
the texture filtering parameter will be just one
more property in PhongMaterial (perhaps in the
Material supertype if it also makes sense for
other possible materials - that can be figured
out later in any case).</p>
</div>
<p class="MsoNormal"> </p>
<div>
<div>
<p class="MsoNormal">On Sun, Jun 25, 2023 at
3:20 PM Matija Brown <<a \
href="mailto:Matija.Brown@outlook.de" target="_blank">Matija.Brown@outlook.de</a>> \
wrote:</p> </div>
<blockquote \
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid \
rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"> <div>
<div>
<div>
<p class="MsoNormal"><span lang="en-DE">Unfortunately
it took a little longer (got busy),
but have just had a quick look at the</span></p>
<p class="MsoNormal"><span lang="en-DE">OpenGL
side of things.</span></p>
<p class="MsoNormal"><span lang="en-DE"> </span></p>
<p class="MsoNormal"><span lang="en-DE">The
ES2Texture class appears to handle
everything there. There are two
create-Methods, but the other</span></p>
<p class="MsoNormal"><span lang="en-DE">one
is responsible for MediaFrame stuff
and it doesn't really? make sense to
have non-linear filtering there?</span></p>
<p class="MsoNormal"><span lang="en-DE">What's
your opinion?</span></p>
<p class="MsoNormal"><span lang="en-DE"> </span></p>
<p class="MsoNormal"><span lang="en-DE">The
create method seems to parse in all
texture parameters simply as arguments
(<a \
href="https://github.com/openjdk/jfx/blob/0d9dcf38275528e1b621d71631aac5bdb9452110/modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2Texture.java#L98" \
target="_blank">https://github.com/openjdk/jfx/blob/0d9dcf38275528e1b621d71631aac5bdb9 \
452110/modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2Texture.java#L98</a>),</span></p>
<p class="MsoNormal"><span lang="en-DE">it
would probably be best to just add the
filtering in there as well.</span></p>
<p class="MsoNormal"><span lang="en-DE"> </span></p>
<p class="MsoNormal"><span lang="en-DE">API-wise
it's probably best to have a Texture
or DiffuseMap class that the
PhongMaterial uses and stores metadata
about the Image.</span></p>
<p class="MsoNormal"><span lang="en-DE">However
this might be slightly overkill
considering there is only this one
single parameter we're trying to add,</span></p>
<p class="MsoNormal"><span lang="en-DE">thus
maybe just a flag in PhongMaterial
would suffice?</span></p>
<p class="MsoNormal"><span lang="en-DE"> </span></p>
<p class="MsoNormal"><span lang="en-DE">Have
a nice day,</span></p>
<p class="MsoNormal"><span \
lang="en-DE">Matija.</span></p>
<div \
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid \
rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span lang="en-DE">From:
</span></b><span lang="en-DE"><a \
href="mailto:Matija.Brown@outlook.de" target="_blank">Matija Brown</a><br>
<b>Sent: </b>Thursday, 22 June 2023
18:37<br>
<b>To: </b><a \
href="mailto:jayathirth.d.v@oracle.com" target="_blank">Jayathirth Rao Daarapuram \
Venkatesh Murthy</a>;
<a href="mailto:nlisker@gmail.com" \
target="_blank">Nir Lisker</a>;
<a href="mailto:kevin.rushforth@oracle.com" \
target="_blank"> Kevin Rushforth</a><br>
<b>Cc: </b><a \
href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a><br> \
<b>Subject: </b>RE: [JavaFX 3D ( | Feature Request)] Setting Texture
Nearest-Sampling on PhongMaterial</span></p>
</div>
<p class="MsoNormal"><span lang="en-DE"> </span></p>
<p class="MsoNormal"><span lang="en-DE">I'll
do the OpenGL – have done quite a bit
with Vulkan and GL in the past so
there's no problem there.</span></p>
<p class="MsoNormal"><span lang="en-DE">Certainly
usefull if you would do some reviewing
– if you finish the Metal texture maps
someone will surely find</span></p>
<p class="MsoNormal"><span lang="en-DE">themselves
to expand it with sampling.</span></p>
<p class="MsoNormal"><span lang="en-DE"> </span></p>
<p class="MsoNormal"><span lang="en-DE">Tomorrow
I'll give a short summary on what
would be to do for OpenGL, as we have
that for D3D already.</span></p>
<p class="MsoNormal"><span lang="en-DE">Then
do a little example probably – doesn't
really seem too much work to me?</span></p>
<p class="MsoNormal"><span lang="en-DE"> </span></p>
<p class="MsoNormal"><span \
lang="en-DE">Thanks,</span></p>
<p class="MsoNormal"><span \
lang="en-DE">Matija.</span></p>
<p class="MsoNormal"><span lang="en-DE"> </span></p>
<div \
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid \
rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span lang="en-DE">From:
</span></b><span lang="en-DE"><a \
href="mailto:jayathirth.d.v@oracle.com" target="_blank">Jayathirth
Rao Daarapuram Venkatesh Murthy</a><br>
<b>Sent: </b>Thursday, 22 June 2023
06:28<br>
<b>To: </b><a href="mailto:nlisker@gmail.com" \
target="_blank">Nir Lisker</a>;
<a href="mailto:kevin.rushforth@oracle.com" \
target="_blank"> Kevin Rushforth</a><br>
<b>Cc: </b><a \
href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a><br> \
<b>Subject: </b>Re: [JavaFX 3D ( | Feature Request)] Setting Texture
Nearest-Sampling on PhongMaterial</span></p>
</div>
<p class="MsoNormal"><span lang="en-DE"> </span></p>
<p class="MsoNormal"><span lang="EN-IN">Correcting
myself:</span><span lang="en-DE"></span></p>
<p class="MsoNormal"><span lang="EN-IN">Currently
I am working on Metal implementation
of Texture maps in JavaFX 3D :
<a \
href="https://bugs.openjdk.org/browse/JDK-8310109" \
target="_blank">https://bugs.openjdk.org/browse/JDK-8310109</a> and not on adding \
nearest
sampling(which last mail can imply).</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal"><span lang="EN-IN"> </span><span \
lang="en-DE"></span></p>
<p class="MsoNormal"><span \
lang="EN-IN">Thanks,</span><span lang="en-DE"></span></p>
<p class="MsoNormal"><span lang="EN-IN">Jay</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal"><span lang="EN-IN"> </span><span \
lang="en-DE"></span></p> <div \
id="m_2886260802899301915m_-7254587722211423081m_-6307084536453969354m_-6205322515822456995m_376544303615863523mail-editor-reference-message-container">
<div>
<div \
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid \
rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" \
style="margin-bottom:12pt"><b><span style="font-size:12pt;color:black" \
lang="EN-IN">From: </span></b><span style="font-size:12pt;color:black" \
lang="EN-IN">openjfx-dev <<a href="mailto:openjfx-dev-retn@openjdk.org" \
target="_blank">openjfx-dev-retn@openjdk.org</a>> on behalf of Jayathirth Rao
Daarapuram Venkatesh Murthy <<a \
href="mailto:jayathirth.d.v@oracle.com" \
target="_blank">jayathirth.d.v@oracle.com</a>><br> <b>Date: </b>Thursday, 22 June
2023 at 9:22 AM<br>
<b>To: </b>Nir Lisker <<a \
href="mailto:nlisker@gmail.com" \
target="_blank">nlisker@gmail.com</a>>,
Kevin Rushforth <<a \
href="mailto:kevin.rushforth@oracle.com" \
target="_blank">kevin.rushforth@oracle.com</a>><br>
<b>Cc: </b><a \
href="mailto:openjfx-dev@openjdk.org" \
target="_blank">openjfx-dev@openjdk.org</a>
<<a href="mailto:openjfx-dev@openjdk.org" \
target="_blank">openjfx-dev@openjdk.org</a>><br> <b>Subject: </b>Re: [JavaFX 3D
( | Feature Request)] Setting
Texture Nearest-Sampling on
PhongMaterial</span><span \
lang="en-DE"></span></p> </div>
<p class="MsoNormal"><span lang="EN-IN">Currently I \
am working on Metal implementation of
the same and has no bandwidth to
work on additional OpenGL thing.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal"><span lang="EN-IN">But I can \
help in reviewing the code if we come up
with addition of nearest
filtering.</span><span lang="en-DE"></span></p>
<p class="MsoNormal"><span lang="EN-IN"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal"><span \
lang="EN-IN">Thanks,</span><span lang="en-DE"></span></p>
<p class="MsoNormal"><span \
lang="EN-IN">Jay</span><span lang="en-DE"></span></p>
<p class="MsoNormal"><span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> <div \
id="m_2886260802899301915m_-7254587722211423081m_-6307084536453969354m_-6205322515822456995m_376544303615863523mail-editor-reference-message-container">
<div>
<div \
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid \
rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" \
style="margin-bottom:12pt"><b><span style="font-size:12pt;color:black" \
lang="EN-IN">From:
</span></b><span \
style="font-size:12pt;color:black" lang="EN-IN">openjfx-dev
<<a \
href="mailto:openjfx-dev-retn@openjdk.org" \
target="_blank">openjfx-dev-retn@openjdk.org</a>>
on behalf of Nir Lisker <<a \
href="mailto:nlisker@gmail.com" target="_blank">nlisker@gmail.com</a>><br> \
<b>Date: </b>Wednesday, 21 June 2023 at 9:40 PM<br>
<b>To: </b>Kevin Rushforth
<<a \
href="mailto:kevin.rushforth@oracle.com" \
target="_blank">kevin.rushforth@oracle.com</a>><br>
<b>Cc: </b><a \
href="mailto:openjfx-dev@openjdk.org" \
target="_blank">openjfx-dev@openjdk.org</a>
<<a \
href="mailto:openjfx-dev@openjdk.org" \
target="_blank">openjfx-dev@openjdk.org</a>><br> <b>Subject: </b>Re: [JavaFX
3D ( | Feature Request)]
Setting Texture
Nearest-Sampling on
PhongMaterial</span><span \
lang="en-DE"></span></p> </div>
<div>
<blockquote \
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid \
rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<p class="MsoNormal" \
style="margin-left:9.6pt"> <span lang="EN-IN">If I
remember correctly, in
OpenGL you parse the
texture filter when the
texture is being created,
while in DirectX as it is
bound</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:9.6pt"> <span lang="EN-IN">to the
sampler (it is a sampler
state after all) it would
have to be set before
every render call. However
it shouldn't make any</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:9.6pt"> <span lang="EN-IN">API
difference really, as we
can just have a field
somewhere and the parse it
along when needed.</span><span \
lang="en-DE"></span></p> </blockquote>
<p class="MsoNormal"><span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> <div>
<p class="MsoNormal"><span \
lang="EN-IN">Yes, the JBS ticket mentions this
difference as well.</span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal"><span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal"><span \
lang="EN-IN">Since Kevin approved this feature and
the API seems to converge
nicely between the
pipelines, we can start
the work. I'm somewhat
busy with other tasks as
of late, but I will try to
formulate an API. Matija
or Jay, if one of you can
start investigating the
changes to the OpenGL
pipeline we could create a
branch in the sandbox repo
and work there.</span><span \
lang="en-DE"></span></p> </div>
</div>
<p class="MsoNormal"><span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> <div>
<div>
<p class="MsoNormal"><span lang="EN-IN">On \
Wed, Jun 21, 2023 at 4:03 PM Kevin
Rushforth <<a \
href="mailto:kevin.rushforth@oracle.com" \
target="_blank">kevin.rushforth@oracle.com</a>>
wrote:</span><span \
lang="en-DE"></span></p> </div>
<blockquote \
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid \
rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"> <div>
<p class="MsoNormal" \
style="margin-bottom:12pt;margin-left:9.6pt"> <span lang="EN-IN">My
preference would be to
add support only for
Linear and Nearest in
any case.<br>
<br>
-- Kevin</span><span \
lang="en-DE"></span></p> <div>
<p class="MsoNormal" \
style="margin-left:9.6pt"> <span lang="EN-IN">On
6/21/2023 4:48 AM,
Matija Brown wrote:</span><span \
lang="en-DE"></span></p> </div>
<blockquote \
style="margin-top:5pt;margin-bottom:5pt"> <div>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">As
Jayathrith said, in
OpenGL as well as
Metal only NEAREST
and LINEAR filters
are available.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> </span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">There
might be a way of
getting around it by
implementing some
own algorithm for
OpenGL and Metal but
that seem slightly</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">over
the top. So either
one would have to
keep the options
limited to the two
supported everywhere</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">or
go with the
"conditional"
features.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> </span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN">Having
had a look at
DirectX the APIs
seem not to differ
too much.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">If
I remember
correctly, in OpenGL
you parse the
texture filter when
the texture is being
created, while in
DirectX as it is
bound</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">to
the sampler (it is a
sampler state after
all) it would have
to be set before
every render call.
However it shouldn't
make any</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">API
difference really,
as we can just have
a field somewhere
and the parse it
along when needed.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> </span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span \
lang="EN-IN">Cheers,</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span \
lang="EN-IN">Matija.</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> </span><span \
lang="en-DE"></span></p> <div \
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid \
rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal" \
style="margin-left:81.6pt">
<b><span lang="EN-IN">From:
</span></b><span \
lang="EN-IN"><a href="mailto:jayathirth.d.v@oracle.com" target="_blank">Jayathirth \
Rao Daarapuram Venkatesh Murthy</a><br>
<b>Sent: </b>Wednesday,
21 June 2023 13:09<br>
<b>To: </b><a \
href="mailto:nlisker@gmail.com" target="_blank">Nir Lisker</a>; <a \
href="mailto:Matija.Brown@outlook.de" target="_blank">
Matija Brown</a><br>
<b>Cc: </b><a \
href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a><br> \
<b>Subject: </b>Re: [JavaFX 3D ( |
Feature Request)]
Setting Texture
Nearest-Sampling
on PhongMaterial</span><span \
lang="en-DE"></span></p> </div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> </span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">In
OpenGL we set
GL_LINEAR by default
at : <a \
href="https://github.com/openjdk/jfx/blob/0d9dcf38275528e1b621d71631aac5bdb9452110/modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2Texture.java#L221" \
target="_blank"> https://github.com/openjdk/jfx/blob/0d9dcf38275528e1b621d71631aac5bdb \
9452110/modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2Texture.java#L221</a></span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> </span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">And
Metal supports only
two types of Min/Max
filters :
Nearest(default) and
Linear. So even if
D3D supports
multiple types we
might be limited to
support only these 2
filters for all
platforms.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> </span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span \
lang="EN-IN">Thanks,</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN">Jay</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> </span><span \
lang="en-DE"></span></p> <div \
id="m_2886260802899301915m_-7254587722211423081m_-6307084536453969354m_-62053225158224 \
56995m_376544303615863523m_4252637545766470404mail-editor-reference-message-container">
<div>
<div \
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid \
rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" \
style="margin-bottom:12pt;margin-left:81.6pt">
<b><span \
style="font-size:12pt;color:black" lang="EN-IN">From:
</span></b><span \
style="font-size:12pt;color:black" lang="EN-IN">openjfx-dev
<a \
href="mailto:openjfx-dev-retn@openjdk.org" \
target="_blank"><openjfx-dev-retn@openjdk.org></a> on behalf of
Nir Lisker
<a \
href="mailto:nlisker@gmail.com" \
target="_blank"><nlisker@gmail.com></a><br>
<b>Date: </b>Wednesday,
21 June 2023
at 3:57 PM<br>
<b>To: </b>Matija
Brown <a \
href="mailto:Matija.Brown@outlook.de" target="_blank"> \
<Matija.Brown@outlook.de></a><br>
<b>Cc: </b><a \
href="mailto:openjfx-dev@openjdk.org" \
target="_blank">openjfx-dev@openjdk.org</a>
<a \
href="mailto:openjfx-dev@openjdk.org" \
target="_blank"><openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>Re:
[JavaFX 3D ( |
Feature
Request)]
Setting
Texture
Nearest-Sampling
on
PhongMaterial</span><span \
lang="en-DE"></span></p> </div>
<div>
<div>
<blockquote \
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid \
rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-GB">First
of all, please
excuse
directly
e-mailing you
earlier today.
Working with
mailing lists
is quite new
for me and
apparently I
forgot to add</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-GB">the
mailing list
to cc.</span><span \
lang="en-DE"></span></p> </blockquote>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN">I
didn't get any
private email,
so you seem to
be doing
better than
you thought
with the
mailing list
:)</span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<blockquote \
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid \
rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">With
the
OpenGL-side I
do have some
experience.
Concerning the
D3D-side of
things it
would probably
mean
convincing</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">Somebody
that it is a
good idea to
finally apply
the suggested
change.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">There
would be some
API change
required of
course. As a
basic concept
it would
probably be
sensible to
add this as a
parameter to
the
\
PhonMaterial-class.</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span \
lang="EN-IN">Alternatively it might make
sense to add a
"Texture"
class that is
used a a
DiffuseMap in
the
PhonMaterial.
But that seems
slightly
overkill.</span><span \
lang="en-DE"></span></p> </blockquote>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN">Where
to put the new
methods in the
Java side is
not the
concerning part,
it's how to
create methods
that match all
the pipelines.
In D3D, the
method for
setting the
filter is
detailed in
[1], and its
possible
parameters in
[2][3][4]. So
suppose that
I'm looking at
the list of
available
filter types
there:</span><span \
lang="en-DE"></span></p> </div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span \
lang="EN-IN">D3DTEXF_NONE, D3DTEXF_POINT,
D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC, D3DTEXF_PYRAMIDALQUAD,
D3DTEXF_GAUSSIANQUAD,
D3DTEXF_CONVOLUTIONMONO,</span><span lang="en-DE"></span></p>
</div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN">if
OpenGL
supports a
somewhat
different set
of filters, we
will have some
clashes in the
Java API side.</span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span \
lang="EN-IN">Generally, we would like
to give as
much
flexibility to
the user as
possible, but
need to be
careful
with platform-specific
functionality.
We could round
*some*
corners. For
example, I
think that if
we have an
enum for the
filter types
above that is
a union of the
ones available
in the
different
pipelines, and
if a few are
supported by
only one of
the pipelines,
we could note
it in the docs
and get away
with it
(something
similar to a
conditional
feature).
However, if
the whole
native
pipeline setup
for texture
filtering is
different,
which means a
different set
of Java API
methods per
pipeline, then
that's too
much.</span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN">All
this means is
that to
continue we
need to figure
out what the
API for each
pipeline looks
like, what's
the most
functionality
we can have
for each
pipeline, and
then how we
can unite them
into a single
Java API with
the hopes of
being able to
reconcile the
differences
"well enough"
(whatever that
will mean).</span><span \
lang="en-DE"></span></p> <div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">[1] <a \
href="https://learn.microsoft.com/en-us/windows/win32/api/d3d9helper/nf-d3d9helper-idirect3ddevice9-setsamplerstate" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/api/d3d9helper/nf-d3d9helper-idirect3ddevice9-setsamplerstate</a></span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">[2] <a \
href="https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dtexturefiltertype" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dtexturefiltertype</a></span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">[3] <a \
href="https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/direct3d9/d3dsamplerstatetype</a></span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt"> <span lang="EN-IN">[4] <a \
href="https://learn.microsoft.com/en-us/windows/win32/direct3d9/vertex-textures-in-vs-3-0" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/direct3d9/vertex-textures-in-vs-3-0</a></span><span \
lang="en-DE"></span></p> </div>
</div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<div>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span lang="EN-IN">On
Wed, Jun 21,
2023 at
12:45 PM
Matija Brown
<<a \
href="mailto:Matija.Brown@outlook.de" \
target="_blank">Matija.Brown@outlook.de</a>>
wrote:</span><span \
lang="en-DE"></span></p> </div>
<blockquote \
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid \
rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"> <div>
<div>
<div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-GB">First
of all, please
excuse
directly
e-mailing you
earlier today.
Working with
mailing lists
is quite new
for me and
apparently I
forgot to add</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-GB">the
mailing list
to cc.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-GB"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">With
the
OpenGL-side I
do have some
experience.
Concerning the
D3D-side of
things it
would probably
mean
convincing</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">Somebody
that it is a
good idea to
finally apply
the suggested
change.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">There
would be some
API change
required of
course. As a
basic concept
it would
probably be
sensible to
add this as a
parameter to
the
\
PhonMaterial-class.</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span \
lang="EN-IN">Alternatively it might make
sense to add a
"Texture"
class that is
used a a
DiffuseMap in
the
PhonMaterial.
But that seems
slightly
overkill.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">As
I am not very
well
acquainted
with current
design
principles of
this library,
these things
should lie in
more
experience
contributors
hands.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> <div \
style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid \
rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal" \
style="margin-left:96pt">
<b><span lang="EN-IN">From:
</span></b><span \
lang="EN-IN"><a href="mailto:nlisker@gmail.com" target="_blank">Nir Lisker</a><br>
<b>Sent: </b>Tuesday,
20 June 2023
20:50<br>
<b>To: </b><a \
href="mailto:Matija.Brown@outlook.de" target="_blank">Matija Brown</a><br>
<b>Cc: </b><a \
href="mailto:openjfx-dev@openjdk.org" \
target="_blank">openjfx-dev@openjdk.org</a><br>
<b>Subject: </b>Re:
[JavaFX 3D ( |
Feature
Request)]
Setting
Texture
Nearest-Sampling
on
PhongMaterial</span><span \
lang="en-DE"></span></p> </div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> <div>
<blockquote \
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid \
rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt">
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">Which
leads to the
question; Does
there, in
JavaFX exist
something
comparable to
setting the
texture-sampler
to NEAREST</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">instead
of LINEAR
sampling?</span><span \
lang="en-DE"></span></p> </blockquote>
<div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">There
is no API to
set the
texture
filter. If you
would like to
contribute and
add it, I can
help. It needs
to be
compatible
with both
Direct3D and
OpenGL (not
sure how the
work on Metal
is going), so
this can be a
challenge.</span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">For
the D3D side,
see this issue
in JBS [1].
The relevant
code is at
[2]. I didn't
look at the
OpenGL side.</span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">-
Nir</span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:96pt"> <span lang="EN-IN">[1] <a \
href="https://bugs.openjdk.org/browse/JDK-8092272" \
target="_blank">https://bugs.openjdk.org/browse/JDK-8092272</a> </span><span \
lang="en-DE"></span></p> </div>
<div>
<p class="MsoNormal" \
style="margin-left:96pt"> <span lang="EN-IN">[2] <a \
href="https://github.com/openjdk/jfx/blob/0d9dcf38275528e1b621d71631aac5bdb9452110/modules/javafx.graphics/src/main/native-prism-d3d/D3DContext.cc#L621" \
target="_blank">https://github.com/openjdk/jfx/blob/0d9dcf38275528e1b621d71631aac5bdb9 \
452110/modules/javafx.graphics/src/main/native-prism-d3d/D3DContext.cc#L621</a></span><span \
lang="en-DE"></span></p> </div>
</div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> <div>
<div>
<p class="MsoNormal" \
style="margin-left:96pt">
<span lang="EN-IN">On
Mon, Jun 19,
2023 at
10:15 PM
Matija Brown
<<a \
href="mailto:Matija.Brown@outlook.de" \
target="_blank">Matija.Brown@outlook.de</a>>
wrote:</span><span \
lang="en-DE"></span></p> </div>
<blockquote \
style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid \
rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin:5pt 0cm 5pt 4.8pt"> <div>
<div>
<div>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">On
my never
ending journey
of building a
Minecraft-clone in every graphics-framework available,</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">I
have come
across JavaFX
for the next
attempt.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">However
a minor
inconvenience
has crossed my
path in the
process:</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">Using
the (very well
developed!)
2D-Graphics
displaying
pixel-art
style images
is no trouble
whatsoever.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">Simply
rendering it
to a canvas
and disabling
smoothing does
the job just
fine.
Unfortunately,
I have been</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">unable
to figure out
how to achieve
a similar
thing using
the
3D-Graphics
engine and the
PhongMaterial
that comes
with it.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">Which
leads to the
question; Does
there, in
JavaFX exist
something
comparable to
setting the
texture-sampler
to NEAREST</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">instead
of LINEAR
sampling?</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span \
lang="EN-IN">Unfortunately the latest
information I
could find
online was
from about
2013 and much
has (probably)</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">changed
since then.
Thus the
question is
being posed
once again.</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN">I
whish to
excuse myself
for probably
repeating a
fairly common
question,</span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:110.4pt">
<span lang="EN-IN"> \
</span><span lang="en-DE"></span></p> </div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal" \
style="margin-left:100.8pt">
<span lang="EN-IN">Kind
regards,<br>
Matija Brown.</span><span \
lang="en-DE"></span></p> </div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<p class="MsoNormal" \
style="margin-left:86.4pt">
<span lang="EN-IN"> </span><span \
lang="en-DE"></span></p>
<p class="MsoNormal" \
style="margin-left:81.6pt">
<span style="font-size:10pt" \
lang="EN-IN"> </span><span lang="en-DE"></span></p> </div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal" \
style="margin-bottom:5pt;margin-left:4.8pt">
<span lang="EN-IN"> </span><span \
lang="en-DE"></span></p>
<p class="MsoNormal"><span style="font-size:10pt" \
lang="en-DE"> </span><span lang="en-DE"></span></p> </div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal" style="margin-left:4.8pt">
<span lang="en-DE"> </span></p>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
</div>
</blockquote></div>
</blockquote></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic