Hi Mathias, I’m back, I read up more on shaders (still not entirely clicking but I think with time I’ll get it eventually), and am trying to apply defold-things/shadowmap at master · Dragosha/defold-things · GitHub in my own project.
Currently I have a light game object and script modified from the controller script in the original project and I want to modify it in editor, not necessarily in game, do you know if there’s any way to visualise the size of the light or the effects of it somehow in the editor or if that’s programmable, or do I have to make a sprite to represent the size and direction of it?
Another thing is that I don’t entirely understand how render_view
works in the original project, I read the function and it makes some sense to me, but why were
self.yaw = 0
self.pitch = 45
self.zoom = 40
self.time = 0
self.light_yaw = 60
self.light_pitch = 45
self.light_zoom = 20
these specific values,
I’m eventually going to modify them to be based on the light’s position, rotation, scale values. Is there any way to combine these sets of values (get rid of the top four) and pass it onto render_view()
in the default.render_script
.
Or I think in my case would it be better to try to just do render_scene()
since I’m not actually changing the light placement in game. I don’t entirely understand the difference between render_view()
and render_scene()
.
Thanks for reading my long TedTalk if you do. Sorry for late response.
Looking at the light game object in the example, it has a value of 0 for rotation, so is that why the light values are set to how they are? Oh I think I get that part somewhat now. So in my case if I want to set it in editor, I’d have to set the yaw and pitch to the rotation of my light game object, I think, but what is ‘zoom’ supposed to be?
If I do get the rotation of my game object, then I think I’d have to convert the quaternion value to yaw, pitch, and roll, which there is an equation for that. Actually I don’t think I need to get the yaw, pitch, or roll, I’d just set self.light_rotation = go.get_rotation(".")
, because since it already returns a quaternion I wouldn’t need to go through the hassle of what the original code was trying to do in the first place.
I guess for the location of where the light is pointing from, I’d have to grab the forward vector of it.