Where is the vertex shader of 3Dtiles?

553 views
Skip to first unread message

shiting...@gmail.com

unread,
Aug 30, 2018, 10:22:40 PM8/30/18
to cesium-dev
1. A concise explanation of the problem you're experiencing.


2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.


3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I want to change the shader to achieve the desired effect, hoping to tell me the source location in how many lines? Best screenshots.

4. The Cesium version you're using, your operating system and browser.
Version: 1.47
I found this ModelUtility. modifyVertexShaderForLogDepth in the source code, but modifying it doesn't do what I want.

Omar Shehata

unread,
Aug 31, 2018, 3:29:18 PM8/31/18
to cesium-dev
I think it depends on the type of data in your 3D Tiles for how it ultimately gets rendered on the screen. For example, this PR (https://github.com/AnalyticalGraphicsInc/cesium/pull/5380) adds support for custom uniforms for point clouds, and you can see if you check the "Files Changed" tab where the code for changing the shader is. 

Most of the shaders should be under the Shaders directory (https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Source/Shaders). For glTF models this is where the materials and shaders get constructed (https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Model.js#L4177).

Let me know if this helps! 

shiting...@gmail.com

unread,
Sep 2, 2018, 9:20:08 PM9/2/18
to cesium-dev
Hi
My model is an oblique photographic model, and I want to achieve partial model flattening, so I want to know where the vertex shader for this model is. I found "gl_Position = u_projectionMatrix * position" on line L305 in the processPbrMetallic Roughness file, not sure if it's here.
Thanks!

shiting...@gmail.com

unread,
Sep 3, 2018, 3:20:19 AM9/3/18
to cesium-dev
在 2018年9月1日星期六 UTC+8上午3:29:18,Omar Shehata写道:
Hi
I've flattened the model, but now I have a new problem. I've marked a point on the tilted photographic model to get the world coordinates. How do I get the local coordinates of this point in the model?

Omar Shehata

unread,
Sep 4, 2018, 4:17:53 PM9/4/18
to cesium-dev
If you mean you have a point in world coordinates, and want to convert that to the model's local coordinates, take a look at the modelMatrix (https://cesiumjs.org/Cesium/Build/Documentation/Model.html#modelMatrix) which converts from world to model coordinates. Its inverse should allow you to do the transformation you need. 

yangb...@gmail.com

unread,
Dec 4, 2018, 9:25:27 PM12/4/18
to cesium-dev
在 2018年9月3日星期一 UTC+8下午3:20:19,shiting...@gmail.com写道:

yangb...@gmail.com

unread,
Dec 4, 2018, 9:30:06 PM12/4/18
to cesium-dev
在 2018年8月31日星期五 UTC+8上午10:22:40,shiting...@gmail.com写道:
hello,

Now i'm using cesium to flatten the 3d tiles model with glsl program, but i don't konw where put the glsl code and how to call it , can you give me some tips or sample code ? thank you!

Omar Shehata

unread,
Dec 5, 2018, 11:42:05 AM12/5/18
to cesium-dev
For creating custom shaders, you'll need to write your own custom Appearance. This tutorial has some info on that:


And I think the materials Sandcastle has an example:

Biao

unread,
Dec 5, 2018, 7:55:59 PM12/5/18
to cesiu...@googlegroups.com

 

Thank you very mush!

 

But I want to draw a polygon on 3d-tiles model , and the model in the range of the polygon is flattened, is this ok?

 

 

发件人: Omar Shehata
发送时间: 2018126 0:42
收件人: cesium-dev
主题: [cesium-dev] Re: Where is the vertex shader of 3Dtiles?

--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/JwNy_FhNspc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

Omar Shehata

unread,
Dec 6, 2018, 11:53:12 AM12/6/18
to cesium-dev
Polygons on 3D Tiles in general should work with classification types, see:


I haven't tried with a custom appearance though. Try it out and let me know how it goes!

To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages