<div dir="ltr"><div>Hi Risto,</div><div><br></div>There is some work on this already here: <a href="https://github.com/openjdk/jfx/pull/1281" target="_blank">https://github.com/openjdk/jfx/pull/1281</a>. I didn't have time to continue with it, so it was auto-closed. To answer your points specifically:<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">Hi, sometimes it is useful to clamp texture coordinates that exceed the normal 0-1 range, however currently the default behaviour is to repeat them and there is no way to configure it.<br>It would be useful to have a TextureWrap property in the PhongMaterial class that would have options like REPEAT, CLAMP, MIRRORED_REPEAT, but the first 2 would be enough.</blockquote><div><br></div><div>I think you're talking about two options that are different, yet similar. There's texture addressing [1] and texture wrapping [2] (showing links for D3D). Wrapping mode is a render state and is performed before texture addressing, which is a sampler state.</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">I am currently trying to replicate the rendering of a custom engine that clamps texture coordinates using the JavaFX 3D api however currently it doesn't seem like it's possible.<br></blockquote><div><br></div><div>You might have a way of doing that with the mesh's texture coordinates. Also have a look at the FXyz library [3] and this SO question [4].</div><div><br></div><div><div style="margin:0px;min-width:0px;padding:0px 0px 20px;width:initial;font-family:"Google Sans",Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium"><div><div id="m_8671912190070048794gmail-:46z" style="direction:ltr;margin:8px 0px 0px;padding:0px;font-size:0.875rem;overflow-x:hidden"><div id="m_8671912190070048794gmail-:46y" style="direction:initial;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;font-size:small;line-height:1.5;font-family:Arial,Helvetica,sans-serif;overflow:auto hidden"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Alternative would be to have some sort of a Texture class that is part of the PhongMaterial which would have that property instead, it could also have additional properties like texture filtering mode (as right now there is no way to configure that either).</blockquote><div dir="ltr"><br></div><div>Texture filtering is the first thing that is implemented in the above PR. Bilinear and nearest-point are available for mag and min filters; mipmap isn't really working for reasons I couldn't determine. You can try it out; see my results from August last year [5].</div><div>The next step in that PR is figuring out what configuration options go into this class (more can be added later, and it should probably be an interface instead of a class anyway). We don't want to cram too many unrelated things into it, making it a kitchen sink class, so I suggested starting conservatively. We also need a unified API for the different current and (possible) future piplines (D3D9, D3D11, OpenGL, Metal, Vulkan), but I did some of that research already and the piplines agree rather nicely [6], so I'm more confident on that front. Specifically, finding out if render states and sampler states both belong there together because this configuration class is applied *per map* (diffuse, specular, emissive, normal), not *per material*. By the way, filtering is also a sampler state, like addressing, so at the very least addressing can be added there.</div><div><br></div><div>- Nir</div><div dir="ltr"><br></div><div dir="ltr">[1] <a href="https://learn.microsoft.com/en-us/windows/win32/direct3d9/texture-addressing-modes" target="_blank">https://learn.microsoft.com/en-us/windows/win32/direct3d9/texture-addressing-modes</a></div><div dir="ltr">[2] <a href="https://learn.microsoft.com/en-us/windows/win32/direct3d9/texture-wrapping" target="_blank">https://learn.microsoft.com/en-us/windows/win32/direct3d9/texture-wrapping</a></div><div dir="ltr">[3] <a href="https://github.com/FXyz/FXyz" target="_blank">https://github.com/FXyz/FXyz</a></div><div dir="ltr">[4] <a href="https://stackoverflow.com/questions/49130485/javafx-shape3d-texturing-dont-strectch-the-image" target="_blank">https://stackoverflow.com/questions/49130485/javafx-shape3d-texturing-dont-strectch-the-image</a></div><div dir="ltr">[5] <a href="https://mail.openjdk.org/pipermail/openjfx-dev/2023-August/042181.html" target="_blank">https://mail.openjdk.org/pipermail/openjfx-dev/2023-August/042181.html</a></div><div dir="ltr">[6] <a href="https://mail.openjdk.org/pipermail/openjfx-dev/2023-August/042136.html" target="_blank">https://mail.openjdk.org/pipermail/openjfx-dev/2023-August/042136.html</a></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 8, 2024 at 10:52 PM Risto Vaher <<a href="mailto:ristovaher1213@gmail.com" target="_blank">ristovaher1213@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">Hi, sometimes it is useful to clamp texture coordinates that exceed the normal 0-1 range, however currently the default behaviour is to repeat them and there is no way to configure it.<br>It would be useful to have a TextureWrap property in the PhongMaterial class that would have options like REPEAT, CLAMP, MIRRORED_REPEAT, but the first 2 would be enough.<br>I am currently trying to replicate the rendering of a custom engine that clamps texture coordinates using the JavaFX 3D api however currently it doesn't seem like it's possible.<br><br>Alternative would be to have some sort of a Texture class that is part of the PhongMaterial which would have that property instead, it could also have additional properties like texture filtering mode (as right now there is no way to configure that either).</div>
</blockquote></div>