lighting

Efficient 2D Tile based lighting system

不羁的心 提交于 2019-11-30 11:57:22
问题 What is the most efficient way to do lighting for a tile based engine in Java? Would it be putting a black background behind the tiles and changing the tiles' alpha? Or putting a black foreground and changing alpha of that? Or anything else? This is an example of the kind of lighting I want: 回答1: There are many ways to achieve this. Take some time before making your final decision. I will briefly sum up some techiques you could choose to use and provide some code in the end. Hard Lighting If

Improved Area Lighting in WebGL & ThreeJS

こ雲淡風輕ζ 提交于 2019-11-30 10:17:44
问题 I have been working on an area lighting implementation in WebGL similar to this demo: http://threejs.org/examples/webgldeferred_arealights.html The above implementation in three.js was ported from the work of ArKano22 over on gamedev.net: http://www.gamedev.net/topic/552315-glsl-area-light-implementation/ Though these solutions are very impressive, they both have a few limitations. The primary issue with ArKano22's original implementation is that the calculation of the diffuse term does not

Improved Area Lighting in WebGL & ThreeJS

独自空忆成欢 提交于 2019-11-29 18:59:32
I have been working on an area lighting implementation in WebGL similar to this demo: http://threejs.org/examples/webgldeferred_arealights.html The above implementation in three.js was ported from the work of ArKano22 over on gamedev.net: http://www.gamedev.net/topic/552315-glsl-area-light-implementation/ Though these solutions are very impressive, they both have a few limitations. The primary issue with ArKano22's original implementation is that the calculation of the diffuse term does not account for surface normals. I have been augmenting this solution for some weeks now, working with the

Libgdx light without box2d

落花浮王杯 提交于 2019-11-28 09:26:22
I just started creating a game using libgdx. It is a top down 2d shooter using scene2d ui. Now i thought, that i could add darkness and light to some levels, but i don't want to rewrite everything using box2d. I don't need realistic shadows just some kind of ambient light and a lightcircle arround my character, which is not affected by walls and other obstacles arround him. So i wanted to know if there is any kind of lightsystem in libgdx? Or can i use box2dlights without using box2d bodies/world...? Thanks Unfortunately there is nothing like this already provided by LibGDX. But you can easily

iOS SceneKit Neon Glow

 ̄綄美尐妖づ 提交于 2019-11-27 23:09:48
Have been looking at lighting on Scenekit, and while I can now apply a lighting node to light something I'm looking for a way to light from within an object. As an example imagine a neon glow, or a lightbulb that casts light on other objects. Any ideas how to achieve this? Many thanks. As @DavidRönnqvist hints in comments, there are multiple ways to make an object appear to glow. You can do these together or individually — you'll probably need to tweak how you combine them to get the effect you want. For an object that emits light, you probably don't want shading from other light sources in

Libgdx light without box2d

蹲街弑〆低调 提交于 2019-11-27 02:53:03
问题 I just started creating a game using libgdx. It is a top down 2d shooter using scene2d ui. Now i thought, that i could add darkness and light to some levels, but i don't want to rewrite everything using box2d. I don't need realistic shadows just some kind of ambient light and a lightcircle arround my character, which is not affected by walls and other obstacles arround him. So i wanted to know if there is any kind of lightsystem in libgdx? Or can i use box2dlights without using box2d bodies

GLSL fixed function fragment program replacement

匆匆过客 提交于 2019-11-27 02:12:20
When using the OpenGL fixed function pipeline for vertex setup, how a fragment program looks like that is compatible to the fixed function vertex setup? I guess that usually depends on the number of light sources and texture layers etc.. So for example how does a simple non-texture one-lightsource goraud shading fragment program look like that replaces GL's fixed function shader? While Gouraud shading calculates the light in the the vertex shader, Phong shading calculates the light in the fragment shader. The standard OpenGL light model is a Gouraud shading model, with a Blinn-Phong light

iOS SceneKit Neon Glow

时间秒杀一切 提交于 2019-11-26 21:37:09
问题 Have been looking at lighting on Scenekit, and while I can now apply a lighting node to light something I'm looking for a way to light from within an object. As an example imagine a neon glow, or a lightbulb that casts light on other objects. Any ideas how to achieve this? Many thanks. 回答1: As @DavidRönnqvist hints in comments, there are multiple ways to make an object appear to glow. You can do these together or individually — you'll probably need to tweak how you combine them to get the

How does this faking the light work on aerotwist?

让人想犯罪 __ 提交于 2019-11-26 16:44:17
I am trying to read up this tutorial: https://aerotwist.com/tutorials/an-introduction-to-shaders-part-2/ but I am not able to follow up. Basically the code creates a directional light by using shaders that run directly on the GPU. This is the code: // same name and type as VS varying vec3 vNormal; void main() { // calc the dot product and clamp // 0 -> 1 rather than -1 -> 1 vec3 light = vec3(0.5,0.2,1.0); // ensure it's normalized light = normalize(light); // calculate the dot product of // the light to the vertex normal float dProd = max(0.0, dot(vNormal, light)); // feed into our frag colour

GLSL fixed function fragment program replacement

旧时模样 提交于 2019-11-26 09:14:17
问题 When using the OpenGL fixed function pipeline for vertex setup, how a fragment program looks like that is compatible to the fixed function vertex setup? I guess that usually depends on the number of light sources and texture layers etc.. So for example how does a simple non-texture one-lightsource goraud shading fragment program look like that replaces GL\'s fixed function shader? 回答1: While Gouraud shading calculates the light in the the vertex shader, Phong shading calculates the light in