lighting

Light source inside a room acting unexpectedly

坚强是说给别人听的谎言 提交于 2019-12-04 06:50:32
I've written several Android apps, but this is my first experience with 3D programming. I've created a room (4 walls, ceiling and floor) with a couple objects inside and am able to move the camera around it as if walking. I've textured all surfaces with various images and everything was working as expected. For context, the room is 14 units wide and 16 units deep (centered at origin), 3 units high (1 above origin and 2 below). There are 2 objects in the middle of the room, a cube and an inverted pyramid on top of it. Then I went to add a light source to shade the cube and pyramid. I had read

Normal mapping and phong shading with incorrect specular component

旧城冷巷雨未停 提交于 2019-12-04 06:45:18
I'm implementing normal/bump mapping in world space coordinates (I find those easier to work with) and my lighting worked fine without normal mapping, but when introducing normal mapping (and the new vectors calculated with the TBN matrix) the specular component of my lighting is off. The specular component is not between the camera and the light where it should be so something is wrong. However, looking at my code I could not find any issues. The tangent and bitangent come from the ASSIMP object loader and the eyePos and lightPos are in world coordinates as well. Since the lighting seems to

How does Minecraft perform lighting?

孤者浪人 提交于 2019-12-03 16:03:02
问题 The only model I'm familiar with is diffuse lighting but this look way more complicated than that. 回答1: Each square has a light level from 15 to 0. Each level is 20% less than the level above it. If a square contains a light source it gets the luminosity of that light source, otherwise it gets one less than the brightest neighbor. Sunlight is special, it suffers no vertical attenuation. 回答2: While the answer by Loren is mostly correct, I’d like to add that the minecraftwiki has further

Realistic lighting (sunlight) with Three.js?

亡梦爱人 提交于 2019-12-03 05:03:59
问题 I'm attempting to create a small 1st-person game using Three.js, but I'm having trouble with the lighting. Basically I want to simulate the sun and have it rotate around casting light on everything. I'm using THREE.DirectionalLight at the moment and it only lights up the one direction so sides of cubes remain black/dark. Do I have to use multiple lights so everything is lit up? Or could I somehow reflect light off the ground/objects? 回答1: Yes, you'll have to use multiple lights to achieve

How does Minecraft perform lighting?

和自甴很熟 提交于 2019-12-03 04:32:26
The only model I'm familiar with is diffuse lighting but this look way more complicated than that. Each square has a light level from 15 to 0. Each level is 20% less than the level above it. If a square contains a light source it gets the luminosity of that light source, otherwise it gets one less than the brightest neighbor. Sunlight is special, it suffers no vertical attenuation. While the answer by Loren is mostly correct, I’d like to add that the minecraftwiki has further information. Sunlight and moonlight works by essentially making blocks with nothing but air and glass above glow with

In a TBN Matrix are the normal, tangent, and bitangent vectors always perpendicular?

被刻印的时光 ゝ 提交于 2019-12-01 21:11:45
This is related to a problem described in another question (images there): Opengl shader problems - weird light reflection artifacts I have a .obj importer that creates a data structure and calculates the tangents and bitangents. Here is the data for the first triangle in my object: My understanding of tangent space is that the normal points outward from the vertex, the tangent is perpendicular (orthogonal?) to the normal vector and points in the direction of positive S in the texture, and the bitangent is perpendicular to both. I'm not sure what you call it but I thought that these 3 vectors

How lighting in building games with unlimited number of lights works?

随声附和 提交于 2019-12-01 08:14:26
In Minecraft for example, you can place torches anywhere and each one effects the light level in the world and there is no limit to the amount of torches / light sources you can put down in the world. I am 99% sure that the lighting for the torches is taken care of on the CPU and stored for each block and so when rendering the light value at that certain block just needs to be passed into the shader, but light sources cannot move for this reason. If you had a game where you could place light sources that could move around (arrow on fire, minecart with a light on it, glowing ball of energy) and

SceneKit - Lighting and casting shadows

蹲街弑〆低调 提交于 2019-12-01 05:55:12
I'm trying to create a spot light that illuminates a cube. The surface underneath should then show a shadow. Unfortunately I wasn't able to achieve this. The light ignores the cube and casts the light on both - the surface and the cube - regardless that the cube is in the way. How it looks like: The code, I just set castsShadow to YES on every node for testing, but nothing so far helped: BOOL shadows = YES; _baseNode.castsShadow = shadows; _scene.rootNode.castsShadow = shadows; SCNBox *box = [SCNBox boxWithWidth: 50 height: 50 length: 50 chamferRadius: 10]; box.firstMaterial.diffuse.contents =

How lighting in building games with unlimited number of lights works?

喜夏-厌秋 提交于 2019-12-01 04:51:45
问题 In Minecraft for example, you can place torches anywhere and each one effects the light level in the world and there is no limit to the amount of torches / light sources you can put down in the world. I am 99% sure that the lighting for the torches is taken care of on the CPU and stored for each block and so when rendering the light value at that certain block just needs to be passed into the shader, but light sources cannot move for this reason. If you had a game where you could place light

SceneKit - Lighting and casting shadows

隐身守侯 提交于 2019-12-01 02:58:35
问题 I'm trying to create a spot light that illuminates a cube. The surface underneath should then show a shadow. Unfortunately I wasn't able to achieve this. The light ignores the cube and casts the light on both - the surface and the cube - regardless that the cube is in the way. How it looks like: The code, I just set castsShadow to YES on every node for testing, but nothing so far helped: BOOL shadows = YES; _baseNode.castsShadow = shadows; _scene.rootNode.castsShadow = shadows; SCNBox *box =