Giter Club home page Giter Club logo

Comments (10)

Jerhammar avatar Jerhammar commented on September 21, 2024

Is it also possible to change the shadow color?

from xbpagecurl.

xissburg avatar xissburg commented on September 21, 2024

The current shadow algorithm is a simple one that assumes an opaque page. A
new, more complex algorithm must be implemented in order to generate proper
shadows for transparent views. I have been thinking about it. Ideas are
always welcome.

from xbpagecurl.

Jerhammar avatar Jerhammar commented on September 21, 2024

Okey, I'm too novice for that, but I can try :P where in the code should i look?
If I fail, is it possible to remove the shadow?

Edit: Got an idea... maybe if the shadow is an image wich gets the same height, angle and position as the curl, not an ideal solution but maybe a quick fix?

from xbpagecurl.

xissburg avatar xissburg commented on September 21, 2024

I still didn't implement a method to disable the shadows. What you can do
is to, in the NextPageNoTextureFragmentShader.glsl, change the main
function to this:

void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); }

Just a quick and dirty workaround..

The problem with transparent views is that the shadow should have the same shape as the alpha of the view. We could use some sort of shadow mapping algorithm.

There's not yet a direct way to change the color of the shadow, but its possible to do so by changing the rgb of the color that is returned in the fragment shader, like gl_FragColor = vec4(0.8123,0.14, 0.59, l).

from xbpagecurl.

Jerhammar avatar Jerhammar commented on September 21, 2024

Thank you :)

I'll read up on shadow mapping and glsl and see if I can come up with something.

from xbpagecurl.

Jerhammar avatar Jerhammar commented on September 21, 2024

I made a quick try and got a somewhat satisfactory result
if (d < 2.0_u_cylinderRadius) {
float a = (d/(2.0_u_cylinderRadius))_M_PI;
l = (d + 1.0)_0.5;
}

gl_FragColor = vec4(0.0, 0.0, 0.0, l);

it is not repeated all over the screen, but it is a solid shadow.

from xbpagecurl.

xissburg avatar xissburg commented on September 21, 2024

Ah I see, you're drawing a linear instead of a cosine shadow. Yea, it should work.

from xbpagecurl.

Jerhammar avatar Jerhammar commented on September 21, 2024

Yeah. the problem is to get it faded, I managed to get it faded one direction, now I'm trying to figure out how to flip the shadow 180°

if (d < 2.0_u_cylinderRadius) {
float a = (d_(1.0/u_cylinderRadius))/M_PI;
//l = (cos(a)+1.0)_0.5;
l = (a)_0.5;
}

from xbpagecurl.

xissburg avatar xissburg commented on September 21, 2024

Try l = d > 0.0? 1.0 - d/(2.0*u_cylinderRadius): 0.0;

On Tue, Nov 1, 2011 at 11:33 AM, Jerhammar <
[email protected]>wrote:

Yeah. the problem is to get it faded, i managed to get it faded one way
now im trying to figure out how to flip the shadow 180

if (d < 2.0_u_cylinderRadius) {
float a = (d_(1.0/u_cylinderRadius))/M_PI;
//l = (cos(a)+1.0)_0.5;
l = (a)_0.5;
}

Reply to this email directly or view it on GitHub:
#13 (comment)

from xbpagecurl.

Jerhammar avatar Jerhammar commented on September 21, 2024

Thanx, worked perfectly!

from xbpagecurl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.