Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The display of a spot light is wrong #171

Open
lesquoyb opened this issue May 15, 2024 · 1 comment · May be fixed by #312
Open

The display of a spot light is wrong #171

lesquoyb opened this issue May 15, 2024 · 1 comment · May be fixed by #312
Assignees
Labels
😱 Bug The issue reveals a bug in GAMA 🖥 Display OpenGL This issue or request concerns only OpenGL displays 👍 Fix to be tested

Comments

@lesquoyb
Copy link
Contributor

Describe the bug
The display of the light with the facet spot set to true seem to be done in function of the camera and not of direction of the light, leading to completely wrong rendering:

https://github.com/gama-platform/gama/assets/6374469/ae1732bb-4fb7-4a10-acaa-363da513df52
on this video you can see the direction of the spotlight moving along with the camera of the display, while the processing of the lightning itself is correct (see the lightning on the ball that is not changing during the whole video)

To Reproduce
Steps to reproduce the behavior:

  1. run this model:
/**
* Name: QuadraticLinearandConstantatenuation
* Based on the internal empty template. 
* Author: baptiste
* Tags: 
*/


model QuadraticLinearandConstantatenuation


global {

	init {
		create GAMAGeometry2D number: 1 {
			location <- {world.shape.width / 2, world.shape.height / 2, 0};
		}

	}

}

species GAMAGeometry2D {

	aspect default {
		draw sphere(10) at: location color: #white border: #gray;
	}

}



experiment Display type: gui autorun: true {
	float minimum_cycle_duration <- 0.01;
	float quad;
	float constant;
	float linear;
	int angle;
	
	parameter "Quadratic attenuation" var:quad <- 0.0001 min:0.0000001 max:0.001 slider:true;
	parameter "Linear attenuation" var:linear <- 0.001 min:0.0000001 max:0.1 slider:true;
	parameter "Constant attenuation" var:constant <- 0.1 min:0.0000001 max:9 slider:true;
	parameter "Spot light angle" var:angle <- 0 min:0 max:360 slider:true;
	
	output {
		layout #split;
		// display using spot lights
		// we set the ambient light to 0 to see better the directional lights (as if we were at night time)
		display SpotLights type: 3d background: rgb(10, 40, 55) {
			
			camera 'default' location: {-87.5648,126.2534,134.3343} target: {50.0,50.0,0.0};
			light #ambient intensity: 0;
			light #default intensity: 0;
			light "1" 
				type: #spot 
				location: {world.shape.width * cos(angle) + world.shape.width / 2, world.shape.height * sin(angle) + world.shape.height / 2, 20} 
				direction:{cos(angle + 180), sin(angle + 180), 0} 
				intensity: #red 
				show: true 
				linear_attenuation:linear 
				constant_attenuation:constant 
				quadratic_attenuation: quad 
				dynamic: true;
			
			species GAMAGeometry2D;
		}
	}
}

  1. move the camera
  2. See error

Expected behavior
The spotlight is displayed as a cone where the apex is at the light location and the base is pointed towards the light direction, moving the camera should affect its appearance

@lesquoyb lesquoyb added 😱 Bug The issue reveals a bug in GAMA 🖥 Display OpenGL This issue or request concerns only OpenGL displays labels May 15, 2024
@AlexisDrogoul AlexisDrogoul self-assigned this Sep 3, 2024
@AlexisDrogoul
Copy link
Member

Should be fixed by #312. Please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😱 Bug The issue reveals a bug in GAMA 🖥 Display OpenGL This issue or request concerns only OpenGL displays 👍 Fix to be tested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants