Improve perfomance of my threejs - camera

I have some issues about my model. Is is an easy model buy I can not make It work well...
I upload my project here: http://webgl.drapps.info
I have a car model with some pieces that change material when mouse is over them. I use threex.domevent.js library with "on" function. My model is loaded by json files.
Issue 1
when mouse is out of canvas, threejs detects that mouse is over a piece of my model, but this is not true, and that piece change its material (triggering mouseOver event).
Furthermore, I tried to get better mouseover event because even when mouse is really over a piece, that event doesn't trigger.
Issue 2
This is about TrackballControls. Is there any way to control rotation of my world? I mean: rotation only in one axis, rotation only for 180 degrees, etc... Is there any tutorial or article to learn how to rotate and translate camera?
Thanks for everything, I will so please to anybody who wants answer this... because I am a little lost
Thanks

Sorry, but you are out of luck.
Question 1. Yikes! You are using threex.js which is a third-party app that hasn't been updated in almost a year, so I can't help you with that.
You are also using an older version of three.js. Please update to the current version.
If you still have problems, post a new question with a simple demo -- not your entire project. Better yet, Google your question first.
Question 2. TrackballControls is not part of the library -- it is part of the examples -- so it is not officially supported. If you are not happy with it, you will have to hack the code yourself.
This question has come up a lot. Google it. To the best of my knowledge, there is not a good solution.
Personally, I would use OrbitControls in your case -- it keeps the scene right-side-up, and you can constrain the maximum polar angle, keeping the camera "above ground".
The best examples/tutorials are the official three.js examples, which will work with the current version of the library.

I can't help with issue 1.
Issue2:
I am also working on a project to visualize vehicles and needed to be able to rotate. I also tried Trackballcontrolls but it did not suit my needs.
What I ended up doing was creating a a master Object3d and then instead of adding objects/models to the scene, I added them to the master Object3d. That way to rotate everything in the scene, I just had to rotate the master object.
To actually do the rotation I just used the code from one of the cube examples.

Related

Unreal Engine 5.1 Retargeted Animation From Manny to Mixamo Model Causes Single Animation Sequence To Rotate 90*

I apologize if this has been asked before. I tried searching for this first and nothing is coming up. I'm pretty new to Unreal Engine 5.1 so this might be something I'm doing as well.
I've been exploring animation retargeting in unreal and have tried following the steps we learned in class using one of the models from mixamo.com. Everything appears to work fine at the start and I can get the actual IK and IKR objects working just fine. However when I try to export the animations either from the IKR object or by right clicking the ABP object for the source mesh one and only one of the animation sequences rotates 90*. It is always the same animation (the Land animation sequence) and I'm not sure how to go about fixing it.
Also tried looking on google and turned up nothing.
I'm hoping this is some stupid newb mistake that is easy to fix or maybe there's something I'm overlooking. Any help is greatly appreciated and I will continue trying to fix the problem myself as well and will post if I fix it
Tried retargeting using the following steps
Create an IK_Object for the model you wish to project your animations on with chains for each. Mine looked like the following
IK_Remy
Repeat step 1 for the model you wish to source animations from. Mine looked like the following
IK_Manny
Create an IKR_Object Linking the two together, here's what mine looked like
IKR_Remy
Find the ABP for your source model, right click, and select "Retarget Animation Assets->Duplicate and Retarget Animation Assets". Here's what I'm selecting for that
Retarget Dialog
When I do the following most of the animation sequences for "Manny" export just fine. However the "Land" animation flips for some reason (see image below)
Exported Animation Images
Even stranger, when I preview the MM_Land animation in my IKR object it looks fine i.e. not rotated. However, if I try to export the animation from the IKR object the same thing happens i.e. it rotates 90*. I would expect this to be a case of WYSIWYG where if it's working in the preview it would export correctly. However that apparently is not the case
Also I tried modifying the animation sequence manually but it won't let me. If I try to rotate the model in the animation sequence and save it, once I close the sequence it's re-rotated and the changes do not persist.
I can export the sequence as a new sequence, modify it, and save it, and then rename it as my exported "Land" animation to hard force it and it at least looks normal. However when I actually play the game and jump, when the land animation it still flips sideways and in addition causes the character to scale and warp for a second which makes me think there's something going on here that I don't know enough to fix. Really hoping someone with more experience in Unreal Engine can help.
EDIT: Fixed Image Descriptions
I can confirm that this is an issue - I'm seeing the same behaviour. I haven't managed to fix it yet, but my suspicion is that it's due to scaling - in my instance, I have had to scale up my custom character by around 2.5 times to replicate the scale of the default mannequin. Did you scale your custom character at all?

java3d simple way to translate object

I am making my first program using Java3D. I have setup some transformGroups that I now need to move in calculated directions. When I looked this up, I found interpolators and alpha objects and waveforms and couldn't understand a word of it. I have done this in the past in OpenGL using simple vectors and frame refreshment. Is there a similar simple way in Java3d? Thanks.
There's no reason you couldn't do it with vectors and frame refresh in Java3D as well.
A simple way would be to attach a behavior to the scenegraph with a WakeupOnElapsedFrames(0) condition, and then have it update the needed transform every frame.
As its simplest, that is was the interpolators are doing for you. Once you get that working, it will probably make more sense as to how you could do it with interpolators.

Create mock 3D "space" with forwards and backwards navigation

In iOS, I'd like to have a series of items in "space" similar to the way Time Machine works. The "space" would be navigated by a scroll bar like feature on the side of the page. So if the person scrolls up, it would essentially zoom in in the space and objects that were further away will be closer to the reference point. If one zooms out, then those objects will fade into the back and whatever is behind the frame of refrence will come into view. Kind of like this.
I'm open to a variety of solutions. I imagine there's a relatively easy solution within openGL, I just don't know where to begin.
Check out Nick Lockwood's iCarousel on github. It's a very good component. The example code he provides uses a custom carousel style very much like what you describe. You should get there with just a few tweaks.
As you said, in OpenGL(ES) is relatively easy to accomplish what you ask, however it may not be equally easy to explain it to someone that is not confident with OpenGL :)
First of all, I may suggest you to take a look at The Red Book, the reference guide to OpenGL, or at the OpenGL Wiki.
To begin, you may do some practice using GLUT; it will help you taking confidence with OpenGL, providing some high-level API that will let you skip the boring side of setting up an OpenGL context, letting you go directly to the drawing part.
OpenGL ES is a subset of OpenGL, so essentially has the same structure. Once you understood how to use OpenGL shouldn't be so difficult to use OpenGL ES. Of course Apple documentation is a very important resource.
Now that you know a lot of stuff about OpenGL you should be able to easily understand how your program should be structured.
You may, for example, keep your view point fixed and translate the world (or viceversa). There is not (of course) a universal solution, especially because the only thing that matters is the final result.
Another solution (maybe equally good, it depends on your needs), may be to simply scale up and down images (representing the objects of your world) to simulate the movement through the object itself.
For example you may use an array to store all of your images and use a slider to set (increase/decrease) the dimension of your image. Once the image becomes too large for the display you may gradually decrease alpha, so that the image behind will slowly appear. Take a look at UIImageView reference, it contains all the API's you need for it.
This may lead you to the loss of 3-dimensionality, but it's probably a simpler/faster solution than learn OpenGL.

OpenCV cvFindContours questions

I'm following this guide: http://www.aishack.in/2010/08/sudoku-grabber-with-opencv/2/
and modifying to iOS 5.0.
I managed to find the largest contour (the sudoku "board"), however, it only locates the surrounding square, without the lines inside, as in the tutorial. can this be easily solved?
I'll try and find a way around it, but still would like to know. thanks!
I assume that you are using the camera right now. Try to load the image what is used in the tutorial and check if your implementation works on that image. Then you can continue with nice sudoku images from the web. You may also change the camera angle and distance from the sudoku when taking pictures to get a better, clearer view.

Zoom-able/ resizable grid with Objective-C

Hi i'm thinking about making midi step sequencer and I need to make a note grid/matrix that resizes/ adapts when you zoom. I've been searching for different ways of doing this but cant figure out a way that works well.
I thought about drawing cell objects made with (NSRect) but I couldn't figure out how to get the right interaction when resizing.
This is my first "biggish" OBJ-c project so please don't kill me, im still battling with the frameworks and the syntax is so foreign to me.
You could use Core Animation layers to create your grid.
Take a look at Apple's Geek Game Board sample code project:
http://developer.apple.com/library/mac/#samplecode/GeekGameBoard/Introduction/Intro.html
The code shows a way to display different kinds of card/board games using CALayer.
The Checkers game looks to be the closest to the grid you want to create.