Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shader Tilling Clamp #742

Open
ChanimeCaio opened this issue Jan 23, 2025 · 2 comments
Open

Shader Tilling Clamp #742

ChanimeCaio opened this issue Jan 23, 2025 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@ChanimeCaio
Copy link

sorry about my english~

Problem:
Placing a gradient in the alpha channel get a hard edge in the transparency end.
After a time trying to figure out this, i saw in Unreal a feature called "Y-Axis Tilling" who can be switched from "Wrap" to "Clamp" and solve this problem.
When exported from Material Maker to Godot the problem persist (Godot haven't a feature like Unreal for this).

This happen in all versions (material maker/godot).
(i don't will show this in material maker 1.4 because are happening transparency inssues, i alredy talked about it )

Video (no audio) showing the problem in Material Maker, Godot, the problem solved and a good spot to put the option.

2025-01-23.17-57-25.mp4

How To Solve:
In the code after "Void Fragment" remove all "fract" and its will work fine.

I'm doing this manually (using "replace" in notepad) in every material after export to Godot.

Feature:
A feature who switch from Shader Tilled to Shader Clamped will allow us see in Material Maker the material whithout this artifact and could make the workflow to export (for Godot) better.

Outro:
In others engines is necessary the manual adjust like Unreal as i said , anyway this make more acuracy the material preview for the user goal and remove the unecessary visual pollution.
I just tested this in my machine, i don't know if this happen in all devices.
Windows 10, AMD Ryzen 5 2600, NVIDIA GeForce GTX 1050 Ti

Code Example (this is just the end of the code):

void fragment() {
	float _seed_variation_ = variation;
	vec2 uv = fract(UV);
float o8322_0_r = 0.5+(cos(p_o8322_rotate*0.01745329251)*((uv).x-0.5)+sin(p_o8322_rotate*0.01745329251)*((uv).y-0.5))/(cos(abs(mod(p_o8322_rotate, 90.0)-45.0)*0.01745329251)*1.41421356237);vec4 o8322_0_1_rgba = o8322_gradient_gradient_fct(fract(o8322_0_r*p_o8322_repeat));

Remove the Fract:

void fragment() {
	float _seed_variation_ = variation;
	vec2 uv = (UV);
float o8322_0_r = 0.5+(cos(p_o8322_rotate*0.01745329251)*((uv).x-0.5)+sin(p_o8322_rotate*0.01745329251)*((uv).y-0.5))/(cos(abs(mod(p_o8322_rotate, 90.0)-45.0)*0.01745329251)*1.41421356237);vec4 o8322_0_1_rgba = o8322_gradient_gradient_fct((o8322_0_r*p_o8322_repeat));

Off topic: a cull option allowing see two sided material could be cool as well 😸 (and let this be exported for godot in the code)

Thanks for your time!

@ChanimeCaio ChanimeCaio added the enhancement New feature or request label Jan 23, 2025
@RodZill4
Copy link
Owner

RodZill4 commented Feb 2, 2025

I tried this in MM1.4a2 and (after fixing the render_mode problem), this does not seem to happen anymore.
It's a bad idea to change this in the preview shader since the material would not show on all faces of the cube.

You can easily create your own export target with whatever fix/change you need. That's the intended way with MM, you can easily adapt the export targets to your specific requirements and workflow.

@RodZill4 RodZill4 added this to the 1.4 milestone Feb 2, 2025
@RodZill4
Copy link
Owner

RodZill4 commented Feb 2, 2025

Dynamic material transparency still needs a fix...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants