light

Three.js shadows not working properly

南楼画角 提交于 2019-12-11 04:02:32
问题 I was trying to learn about shadows in Three.js and I found this nice example in jsfiddle. However I am not able to understand why, when I lower the y of light to like 65, that is: light.position.set( 20, 65, 0 ); the shadow disappears completely. Meanwhile, everything above 70 is perfectly fine and the shadow is cast. Like always, I am probably missing something obvious, but I really cannot see what can be preventing the light from making that shadow. 回答1: You can try: light

GLSL spotlight projection volume

筅森魡賤 提交于 2019-12-10 17:09:35
问题 In my open source project I have setup a deferred rendering pipeline using Qt3D. So far so good, but now I'd like to move forward by adding spotlights projection volume. (e.g. as if there is smoke in the scene) Like this: The fragment shader I'm using is at the end of the question. I've read that for each fragment I should do ray marching from the light position and find the intersections with a cone, but I have no idea how to translate this into GLSL. I can easily add a uniform with the

OpenGL stencil buffer OR operation?

余生颓废 提交于 2019-12-09 11:59:25
问题 I'm not sure if this is possible to do, but it's worth a shot. I'm using the stencil buffer to reduce overdraw for light volumes in a deferred renderer using this algorithm (when the camera is outside the volume): Using a cheap shader, draw back faces with depth testing set to LEQUAL, marking them in the stencil buffer. Using the expensive lighting shader, draw front faces with depth testing set to GEQUAL. This will cause only pixels within the light volume to be shaded. The problem with this

Three.js, custom light geometry

牧云@^-^@ 提交于 2019-12-08 02:44:48
问题 Is it possible to create in Three.js a light source that has custom geometry, e.g. symbol. There is Arealight in Three.js that works as rectangular source of light and which has wigth and height parameters. Finally, the aim is to get a surface illuminated by a such source, which visually is that custom figure. Thank you WestLangley, this is a great example, I tried this way, but unfortunately, it didn't work for me. I tried this: var textTexture = new THREE.Texture( "textures/text.jpg" ); /

Does iPhone allow Light sensors as input?

风格不统一 提交于 2019-12-07 05:49:28
问题 I was just wondering whether iPhone developement allows light sensors to be used, as buttons or action elements?? I found this link online... Possible to use Light Sensor as a Button? [Archive] - Touch Arcade If anyone could shed some light on the issue, I'd appreciate the help? Cheers. Divanshu. 回答1: An official answer by an Apple rep is on the Apple Dev Forums (login required): There's no supported way to get at the ambient light sensor. If you'd like to see such support added in the future

Three.js, custom light geometry

允我心安 提交于 2019-12-06 12:54:30
Is it possible to create in Three.js a light source that has custom geometry, e.g. symbol. There is Arealight in Three.js that works as rectangular source of light and which has wigth and height parameters. Finally, the aim is to get a surface illuminated by a such source, which visually is that custom figure. Thank you WestLangley, this is a great example, I tried this way, but unfortunately, it didn't work for me. I tried this: var textTexture = new THREE.Texture( "textures/text.jpg" ); //var textTexture = THREE.ImageUtils.loadTexture("textures/text.jpg"); textTexture.format = THREE

Lighting maps_练习一

强颜欢笑 提交于 2019-12-06 05:12:07
尝试在片段着色器中反转镜面光贴图的颜色值,让木头显示镜面高光而钢制边缘不反光(由于钢制边缘中有一些裂缝,边缘仍会显示一些镜面高光,虽然强度会小很多) 1 #version 330 core 2 out vec4 FragColor; 3 4 struct Material { 5 sampler2D diffuse; 6 sampler2D specular; 7 float shininess; 8 }; 9 10 struct Light { 11 vec3 position; 12 13 vec3 ambient; 14 vec3 diffuse; 15 vec3 specular; 16 }; 17 18 in vec3 FragPos; 19 in vec3 Normal; 20 in vec2 TexCoords; 21 22 uniform vec3 viewPos; 23 uniform Material material; 24 uniform Light light; 25 26 void main() 27 { 28 // ambient 29 vec3 ambient = light.ambient * vec3(texture(material.diffuse, TexCoords)); 30 31 // diffuse 32 vec3 norm =

OpenGL: Rendering more than 8 lights, how?

╄→尐↘猪︶ㄣ 提交于 2019-12-06 00:24:56
问题 How should I implement more than 8 lights in OpenGL? I would like to render unlimited amounts of lights efficiently. So, whats the preferred method for doing this? 回答1: Deferred shading. In a nutshell you render your scene without any lights. Instead you store the normals and world positions along with the textured pixels into multiple frame-buffers (so called render targets). You can even do this in a single pass if you use a multiple render-target extension. Once you have your buffers

Does iPhone allow Light sensors as input?

試著忘記壹切 提交于 2019-12-05 09:22:00
I was just wondering whether iPhone developement allows light sensors to be used, as buttons or action elements?? I found this link online... Possible to use Light Sensor as a Button? [Archive] - Touch Arcade If anyone could shed some light on the issue, I'd appreciate the help? Cheers. Divanshu. An official answer by an Apple rep is on the Apple Dev Forums (login required): There's no supported way to get at the ambient light sensor. If you'd like to see such support added in the future, I encourage you to file a bug describing your requirements. While we may have seen similar requests many

Android light sensor not triggering event

前提是你 提交于 2019-12-04 23:39:40
问题 When using the light sensor, I have an issue where the onSensorChanged() event is never triggered. The reason is that when the listener is registered, if the lux value remains constant, there's no change thus no event. However, I still want to know the lux value! There's a difference between a constant lux value of 0, and a constant of 60,000! After some research, I realised that there's no way to directly read the lux value of the sensor. So how do I get the lux value if it's constant, and