heremaps / harp.gl

3D web map rendering engine written in TypeScript using three.js
Apache License 2.0
1.28k stars 197 forks source link

Help with custom shader water layer #2388

Open d3vilsn0w opened 2 years ago

d3vilsn0w commented 2 years ago

Something like this. https://github.com/heremaps/harp.gl/issues/1854

Thanks

d3vilsn0w commented 2 years ago
Screenshot 2022-03-22 at 5 46 52 PM

My output is like this currently

            theme: {
                extends: "resources/berlin_tilezen_base.json",
                styles: {
                    tilezen: [
                        {
                            layer: "water",
                            when: ["==", ["geometry-type"], "Polygon"],
                            renderOrder: 10000,
                            technique: "shader",
                            description: "water",
                            primitive: "mesh",
                            textureCoordinateType: "feature-space",
                            transparent: true,
                            params: {
                                vertexShader: `
                                varying vec2 vUv;
                                void main()
                                {
                                    vUv = uv;
                                    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
                                }
                                `,
                                fragmentShader: `
                                varying vec2 vUv;
                                void main()
                                {
                                    vec2 p = vUv - 0.5;
                                    float r = sqrt(dot(p, p));
                                    gl_FragColor = vec4(0, r, r, r);
                                }
                                `
                            }
                        }
                    ]
                }
            }
d3vilsn0w commented 2 years ago
Screenshot 2022-03-22 at 7 39 19 PM

Shows something like that now. texture do not appear.

nzjony commented 2 years ago

Does this help: https://github.com/heremaps/harp.gl/issues/1854#issuecomment-702627014 ?

d3vilsn0w commented 2 years ago

Does this help: #1854 (comment) ?

It did not help. i will try again later today. Keep you updated soon.