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

add param computeLength and append v_distanceCamera when needed #12343

Closed
wants to merge 5 commits into from

Conversation

mickae1
Copy link
Contributor

@mickae1 mickae1 commented Nov 27, 2024

I'm working on custom shader, and I've some change needed to be done, on the core of cesium that I think will help others also.

By example, the dash material for polyline will be improved later ( the dash pattern depend of the position of the camera, which make the dash pattern move when the camera move which is not nice )

To help that, I need to know the distance of the fragment shader from the first point of the polyline.
That why, I added an attribute in the class PolylineGeometry. By default it's desactived, and it can be activated with the option computeLength.

In my custom shader, I need also to know the distance of the camera, which is already done here :

" distanceSq = max(distanceSq, 0.0); \n" +

so I just prepend in the vertexshader :
"out float v_distanceCamera; \n" +

when the function _appendDistanceDisplayConditionToShader is called.

which help me to show/hide, change object property in the custom shader depending of the distance of the camera from the object.

I think this will help also other.

Michael,

Copy link

Thank you for the pull request, @mickae1!

✅ We can confirm we have a CLA on file for you.

…parameter to the custom shader, usefull for dash polyline

add out float v_distanceCamera when Primitive._appendDistanceDisplayConditionToShader is running
@ggetz
Copy link
Contributor

ggetz commented Dec 9, 2024

Thanks for the suggestion @mickae1! A world-space polyline dash material (rather than our current screenspace implementation) has been a common community request, so happy to hear you are working on it.

@jjhembd Would you be able to take a look at the overall approach here?

@ggetz ggetz requested a review from jjhembd December 9, 2024 18:37
@mickae1 mickae1 closed this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants