I'm playing with box2dlights but I don't understand well the use of diffuse light, and I can't find any documentation anywhere...
I have problems depending on the RayHandler settings:
If I enable the diffuse light in the Ray Handler and the shadows or the blur is active, everything is dark and I don't see any light (not even the ambiance one).
In the other hand, if the diffuse lights are disabled
RayHandler.useDiffuseLight(false);
or the blurNum is 0, or the blur is disabled, and the shadows are disabled too, the lights are rendered...
Any ideas of why is this happening?
Is the diffuse light incompatible with shadows or blurring?
You need to set ambient light in a different way otherwise it will not have any lighting at all. Use this instead:
setAmbientLight(float r,float g,float b,float alpha)
Related
I am new to libGDX and Box2dlights i made a point light but there is a very weird problem the shadow is the same color of the point light - this is so weird when my sprite cross the light range it casts a shadow with the same color of the point light
try setting .setSoftnessLength to 0f setSoft(false) maybe add more light rays (50-100 is good enough in 80% of cases )
how light behave when it has small number of rays
Sorry my drawing is awful. more rays = more accurate shadows. to keep good level of performance try to reduce ray length . and make ambient light more bright to fake light level. make sure x-ray disabled. set soft to false also is good for performance. because we don't have any code it is hard to guess what is going on. i am just suggesting
I have investigated how the blur shader is applied to sprite in tests of cocos2d-x (ShaderTest/ShaderTest2.cpp).
Now my problem is a bit different: I have a layer initialized as follows:
LayerColor::initWithColor(Color4B(0, 0, 0, 180)
So it is black but transparent. My intention is to show the content under the layer but with bad visibility.
Now I need to add a blur effect to make visibility under my ColorLayer even worse.
My first question is how I can do that?
The second why cocos2d-x does not support such simple and vastly used effects such blur is without using shaders?
P.S. I usecocos2d-x 3.0.
I have a typical fire particle effect. (i am not going to show the particle code, the default demo particle at the open of the particle editor works as example).
I need to check the Additive option to make the particles sum theirs colors to reach the desired effect of fire.
Later, in my LibGDX game, the fire particle effect draws against a blue sky background. The fire effect do a transparency agains the blue background and the fire seems pink.
Is nice as magic fire, but i want to draw a normal fire. In black background it seems ok.
How i can archive a normal fire, without sum their color with the background, but without check the needed Additive option in the particle effect?
I have test several things, without any result...
I am trying to make an 'Eraser' for my fabricjs-based 0.5 Opacity free drawing app(with non-trivial background image), i. e. everything drawing is half-transparent and we still can see the background through the free drawing.
However I understand by default all free drawing are 'path-based' i. e. everything we draw (between mouse-down mouse up) is captured as an individual path in the canvas, so it is not possible to erase arbitrary part of the path. So I am thinking maybe we can capture the mouse-down/up event manually and draw an image pixie by pixie and place it on the canvas with opacity=0.5? so that we can use white to overwrite all those 'old' drawing?
Is this a workable/efficient enough solution?
However I am not sure how this can be implemented in fabricjs? could you please give me some advise on the steps or some pseudocode? thanks
I didn't complete my attempt when i had a similar problem , but the basic concept was simple 'Read the pixel under the cursor(and under the canvas, where another canvas with a background image was) and paint the path with the same color' , creating an eraser effect. The starting stone was this jsfiddle.net/DV9Bw/1/ maybe it can help you out, i didn't try it to its completion since the idea was quickly abandoned
I’ve working in an app system that take the ID Photos, but the webcam whitebalance ajust isn’t perfect.
In the background we put an white fabric but it still look other color (kind of yellow, gray, blue, depending of the light at the moment of the snapshot).
I’m trying to work with the blend mode “hardlight” in the webcam, plus magicWand to remove the background and turn it completely white, but the skin tone doen’t look natural.
Using the levels correction in photoshop, I can define the right point of White and then use the MagicWand to clean the image.
How can I do the same using AS3?
I would look into using the paletteMap functionality built into bitmapData. It allows you to replace colour values on a per colour index basis.
You could, in theory, use a picker to choose the White balance point, and then use that as an offset for the palletteMap values.
Read more about palletteMap here:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html#paletteMap()