Jump to content

Basic Math Knowledge for Video Games


ProfessorF
 Share

Recommended Posts

I have a little problem with lookAt .I use a plane with a texture and I have a rotation of 3.14 minimum so that the textures display correctly (otherwise she is black). But if I use lookAt so that the plane look the camera, the texture becomes black when I turn around

 

I made:

engine.runRenderLoop(function(){                   scene.render();                  parentCamera.lookAt(cameraFree[0].position, 3.14);            });
Link to comment
Share on other sites

I am sorry ProfessorF, all my project is in place on EasyPHP in local. But I am going to try to make an example to reproduce the probleme.

I have point out also that the lookAt does not look from above or downwards with one plane who look at FreeCamera.

I you dispatches an example of problem as soon as I finished

Link to comment
Share on other sites

Is it because you only have one directional light?  If you add more lighting sources, it should make the dark part lighter.  Could you try:

 

    var LightDirectional = new BABYLON.DirectionalLight("Sun", new BABYLON.Vector3(-1, -2, -1), scene);
    var LightDirectional1 = new BABYLON.DirectionalLight("Sun", new BABYLON.Vector3(1, -1, 1), scene);
    var LightDirectional2 = new BABYLON.DirectionalLight("Sun", new BABYLON.Vector3(0, -1, 0), scene);
Link to comment
Share on other sites

Yes, it is much better, but in the diagonals of the terrain the textures remains black one moment. But it is a lot better with more light.
Thank you very much for your time ProfessorF.

Otherwise by attaching (with parent) a light point in front of the camera, it could not completely resolve the problem. It is an idea.

Link to comment
Share on other sites

  • 3 weeks later...

True.  Good point.  neoRiley is working with sun and moon.  Shadows are important.  I should learn to read.  :)

 

Spotlights do not cast shadows either, as I found out the difficult way, this morning.  :)

 

I have SO much to learn.  Good luck on your projects, friends.  I enjoy reading about them.

Link to comment
Share on other sites

  • 1 month later...

Hi friends.  Does anyone (other than me) have an issue with the name 'lookAt'?  I don't really like it.  That is a name for a camera method, imho.

 

FreeCamera has a method named setTarget(), but no .target.  And should IT have an optional yaw, pitch and roll, like mesh.lookAt() ?

 

ArcRotateCamera has a .target, but no method named setTarget().

 

And I recently discovered...  spotlight.direction = BABYLON.Vector3.Normalize(to.subtract(from));  (After a week of studying - yay!  I am starting to understand .direction... finally.  Phew.) 

 

That simple discovery above... is a future setTarget() or lookAt() method... for spotLights, directionalLights, (and maybe hemisphericLights).  Such a method would make teaching .direction in the lighting tutorial... much easier.  And, I think such a method would be super handy.

 

To summarize, should we get consistent and standardized?  Should lights, cameras, and mesh, ALL use .setTarget()?  If so, they would each be different methods, but would have a common name for all.  Maybe?  Thoughts?

 

I would prefer using .setTarget for everything.  Not the same method functionality, just the same names and maybe the same parameters for each scene item type.  Maybe not possible.  Maybe not like other engines.  I am still learning, and will be doing that for 1061 more years.  :)

 

Thoughts?  Too many questions in one post?  Sorry.  Thanks for comments!  I hope I get some comments.  The forum has been looking like a ghost town, recently.  :(  Come back, everyone!!!  PLEASE!!  I am lonely!  :)

Link to comment
Share on other sites

  • 2 weeks later...

@Wingnut - I can see where you're going with setTarget() rather than lookAt() and I can't say I totally disagree or agree.  However, in every other 3D engine I've worked with, lookAt() has been used to describe a method that points one object on it's forward axis toward the pivot point of another object.  I've used setTarget() as a method for several different types of work and so I think setTarget is a bit too generic.

 

Since lookAt() seems to be widely adopted and used and setTarget() is more generic, I'd suggest staying with lookAt()

Link to comment
Share on other sites

Yeah, we gathered that you did, d72.  sigh.  Got grounds (logical reasons) for your agreement?  Care to tell us what they are?

 

Anyway, http://tinyurl.com/m8gujw3  ThreeJS, Away3D, Ogre,  Object3D, Cinder... all camera.lookAt().  *shrug*

 

NeoRiley, could you tell me which engines you worked-with... that used mesh.lookAt().  Thanks.

 

It looks like ThreeJS might have a .lookAt() for both meshes and cameras.  And it looks like an engine called Irrlicht... uses a setTarget() on their cameras... like we do here.  http://en.wikipedia.org/wiki/Irrlicht_Engine

Link to comment
Share on other sites

Looks like papervision's lookAt() allows a mesh or camera.  Interesting.

 

http://snipplr.com/view/13579/papervision3d--lookat/  .

 

Oh well.  Thanks for the information, NeoRiley.  I guess I'm rowing against the current. 

 

I really have no problems with mesh.lookAt() existing, but I think there should be one on freecams.  I have been working on the basic series camera tutorial.  These 'lookAt' and 'setTarget' and 'lockedTarget' things are kind of important to me, because I need to try to explain how they all work... to old people. :D

 

Now we have a total of 7 types of cameras in BJS (although some are derivatives of free and arc).  I think I am going to have a nervous breakdown.

 

You type fine English, NR.  Want to help write tutorials?  :) Currently, the rate of additions to the BJS framework is easily outrunning my abilities to even catch-up, speak nothing of keep-up.

Link to comment
Share on other sites

As far as I'm concerned, I would use lookAt to tell the camera to look at the object but NOT to lock it as a target. By this, I mean that if the object moves, the camera won't look at it anymore and at some point we won't see the object anymore. Whereas I would use setTarget to tell the camera to look at the object and lock the target: if the object moves the camera is updated to still look at it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...