New answers tagged

0

One way to accomplish this is to use the shader to render something like light map. So you create a grayscale image which can then be used in other shaders as an mask. Moreover this way you can enhance the light effect by applying some blur or other filters.


0

Consider a torch like this: 0-----1-----2-----3 fire starts at 0 A torch will burn with the same brightness as long the burn-rate is lower than the available fuel. So suppose the burn rate is ---- per time unit, it will burn with a constant light emmission from 0 to 2.5. If the amount of fuel is lower than the burn rate, the brightness will deminish ...


0

I suggest to check this project, Shade. There is real-time lighting and moving shadows, I think could be useful for you


3

First Question: The dot product basically tells you how much two vectors are pointing in the same direction. So if a light points directly against the normal of a surface the surface will be brighter than if it points at it in an angled way or away from it. If you are struggling with getting this to work, I would advise very heavily against trying to ...


0

The singular value decomposition produces the Eigenvalues with largest magnitude, and their corresponding Eigenvectors. If one were to decompose every Eigenvector of a matrix, they have performed a Principle Component Analysis. The principal components represent the 'n'-dimensional axes on which the most variance is encoded. Therefore they can be used as ...


2

There is no canonical "correct way" to approximate general functions. Sorry. With that said, the very source you linked to has suggested the Lafortune representation. This representation has been described as "...compact and works well for hardware rendering..." in chapter 18 of GPU Gems. Implementation details appear to be out of scope for this question. ...


0

I have a different view/answer about the formula. When we view a spot light, for example, actually we see the light scattering. So the formula of 1/d^2 is only for the emit light of that pixel. But the brightness in our camera of that pixel will have a more complicated formula, which will use light scattering theory. See the paper "Epipolar Sampling for ...


2

I won't be able to make an image for you, but one trick you could do to figure out if a piece of wall should light up is to take advantage of the 'alpha' channel for determining the direction the pixel is facing, as opposed to the opacity of the pixel. You could then determine whether the pixel should be lit between the light source and the facing of the ...


12

Going to try and doodle up what I mean here as soon as I finish typing this, but: What about merging the two? Use the second (occlude by base) for everything that isn't a wall and the first (occlude by tops) for lighting the walls? You actually did this by accident in your second example, with the wall that goes off the bottom of the image. Extending ...


1

Unfortunately, when it comes to lighting, some way or another, you'll need some normals. As you mentioned, for flat shading, you need per triangle normals, which implies vertices duplication, compared to smooth shading. The most often used techniques to compute normals in an OpenGL shader (using dfx/dfy or geometry shader) are not available in gles 2.0. ...


2

You can set spotlights and simulate light by a raycast algorithm and interpolate to have the light intensity, here's an approximation in javascript that i wrote to test something similar some time ago, read it carefully, it's not clean as it could be but it can help you to find out your own solution. var canvas = ...


2

For a very simple effect just load an alpha image with a white circle in the center and otherwise all black into an SDL_Texture and render it centered to your character. Anything inside the white circle will stay visible while the rest will become black. You could also make the texture animated creating a "candlelight" effect. You could also scale the ...



Top 50 recent answers are included