Stuck in 7days series tutorial Blender - blender

currently I've been following this day6 tutorial https://www.youtube.com/watch?v=IYEaY6RTUzc&t=2169s and I am stuck in 36:09 .
Problem is when I try to extrude that circle the extrusion doesn't come like the one in the tutorial although I think I did everything the same .
This is the result I get https://youtu.be/5AwpbDEInP0

Apply the shrinkwrap modifier before extrude faces. If the problem persists, try extruding along normals from Alt + e or extrude along the z axis with e + z, then press 3 to right view and adjust it with g + z.

Related

Need deep explanation for viewport /perspective/frustum calculations

I have a lot of tutorials & books, but I'm unable to understand how my viewport, my near & far distance etc are used to calc perspective / frustum matrix.
I have the learningwebgl lessons, but.... I dont understand what viewport & 3D space adjustments are made.... What is my initial window projection size ? Why I see the triangle & square placed at z = -7.
Another thing I dont understand . A near plane of 0.001 creates the window projection just in front of my nose ? So what is my projection window dimension ?
I need a very deeper and basic help....
Can anybody help me ? Some really usefull links? I need graphical examples showing & teaching how frustum is calculated.
Thanks
There's this
http://games.greggman.com/game/webgl-3d-perspective/
Imagine you're in 2D. You have a canvas that's 200x100 pixels. If you draw at x = 201 it will be off the canvas. Similarly at x = -1 it will be off the canvas.
In WebGL it works in a 3D space that goes from -1 to +1 in x, y and z. The perspective / frustum matrix is the matrix that takes your 3d scene and converts it to this -1 / +1 space. The near and far values define what range in world space get converted to the -1 / +1 "clipspace". Anything outside that range will be clipped just like the 2D example. If you set near to 10 and far to 100 then something at Z = 9 will be clipped because it's too near and something at 101 will also be clipped as something that's too far. More specifically the near and far settings will form a matrix such that when a point is at Z = near it will become -1 when multiplied by the matrix and when it's at Z = far it will become +1 when multiplied by the matrix.
The viewport setting tells WebGL how to convert from the -1 to +1 space back into pixels.

Barycentric coordinates texture mapping

I want to map textures with correct perspective for 3D rendering. I am using barycentric coordinates to locate points on the faces of triangles. Simple affine transformation gave me that standard, weird looking result. This is what I did to correct my perspective, but it seems to have only made the distortion greater:
three triangle vertices v1 v2 v3
vertex coordinates are v_.x v_.y v_.z
texture coordinates are v_.u v_.v
barycentric coordinates corresponding to vertices are b1 b2 b3
I am trying to get the correct texture coordinates U and V
z=b1/v1.z + b2/v2.z + b3/v3.z
U=(b1*v1.u/v1.z + b2*v2.u/v2.z + b3*v3.u/v3.z) / z
V=(b1*v1.v/v1.z + b2*v2.v/v2.z + b3*v3.v/v3.z) / z
This SHOULD work shouldn't it? Why isn't this working?
EDIT: The response on this page looks useful, but I am unsure what the w coordinate is. Maybe somebody could just explain that, which would also likely solve my problem. http://www.gamedev.net/topic/593669-perspective-correct-barycentric-coordinates/
note: My tags were all wrong at first. That is now fixed.
Okay, this one I DID manage to solve on my own. I was dividing by the z coordinate in screen space. The solution is to divide by the homogeneous w coordinate instead.
Well, that took a while to figure out.

Adding a second x axis to a TGraph in the CERN ROOT program

does anyone know the method or code to add a second x axis to a TGraph in CERN's ROOT program? Ive been searching the root website and its documentation almost always confuses me. What i need is just one plot of data, but a second X axis on top whose values are a function of the bottom x axis' values. Its basically so lazy people dont have to convert from the numbers of the bottom x axis to the top x axis.
For a simple example (if i wasnt clear)
Say you have a sine curve which is some function of theta. On the top x axis we could have degrees whereas on the bottom we could have radians with 360deg corresponding to 2pi rad...
Any help would be appreciated!
TGaxis is the class you are looking for to draw extra axes wherever you desire. Grabbing the world coordinate for your pad you can then superimpose like so. Replace low and high with the appropriate limits.
// your graph code here...
TGraph->Draw("AP");
TGaxis *axis = new TGaxis(gPad->GetUxmin(),gPad->GetUymax(),gPad->GetUxmax(),gPad->GetUymax(),low,high,510,"+L");
axis->Draw();
Check out TGaxis documentation for more examples.
(A previous answer I had was deleted as it was just a link to the site listed as a reference below. I hope this is more in line with the community guidelines.)
I think this might do what you want.
void axis2() {
TH1F *h = new TH1F("h","test",30,-3,3);
h->FillRandom("gaus",10000);
h->Draw();
TText t;
t.SetTextSize(0.02);
t.SetTextAlign(22);
Double_t yt = - h->GetMaximum()/15.;
for (Int_t i=1;i<=30;i++) t.DrawText(h->GetBinCenter(i),yt,Form("%d",i%10));
}
It doesn't create another taxis but shows you how to draw text at the same location of the axis. The answer comes from Rene Brun himself (one of the main authors of root) so I don't think you can have two x axes.
Source:
http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=7110
Here is an example showing how to proceed.
https://root.cern/doc/master/twoscales_8C.html

Objective C Game Geometry question

I'm creating simple game and reached the point where I feel helpless. I was good in geometry but it was long time back in school, now trying to refresh my mind.
Let's say i have iPad screen. Object's xy position at one given point of time and xy position at another point of time stored in 2 variables .
Question:
how to find the third position of the object at the end of the screen being given previous 2 position, considering the object moves in the same direction (line) from point 1 to point 2.
Thanks in advance.
Let us have that v1 and v2 are the vectors representing the two points. Let t0 be the time between the two points. Let t be the current time.
Then our location vector v3 is given by v3 = v1 + (v2 - v1)t/t0
If the object is moving in the same direction and you have an horizontal line, the next position given x and y would be
x+1, y
If the object is moving in the same direction in a vertical line it would be
x, y+1
If the object is moving in a diagonal up-right
x+1,y+1
diagonal down-right
x+1, y+1
diagonal down-left
x-1, y-1
diagonal up-left
x-1, y+1
So something general would be :
newPosition = (x+1,y) //if you wish to move forward to the right, try to handle all
cases
All the cases above work if the object is moving forward, if it is moving backwards just change the + by - . Basically think of the object as moving in a cartesian coordinate system, where x is horizontal and y is vertical.
I think you can get the idea out of this three cases ;)

How Do I Switch Y and Z Axises from Blender? (So Y is Up)

I've been having a bit of a problem with making the Y axis my up axis when exporting mesh and scenes from Blender. Both Blender and my export target use right handed transformation matrices. Z is the up axis in Blender while Y is the up axis in my target. The problem exists in 2 places though. The scene's transformations can't just be shifted on the X axis to fix this, because I also need to do the Y/Z switch for the vertices in the mesh (export as vertex.x, vertex.z, vertex.y). I need to have the actual Y and Z rotations switched, so that if the Y and Z rotations are the same, no change will occur (ie. identity). Thanks for your help in advance. Feel free to ask questions if I was not thorough enough.
Blender does two things different than the rest of the known world!
1. It uses Z axis for vertical (should be Y); Y axis for horizontal (should b X); and X axis for in and out (should b Z).
Very weird! Every high school graph since the beginning of time uses X for horizontal and Y for vertical.
It uses the right mouse button for selections.
U can change the selection btn in Preferences, but not the crazy axis arrangement!
no,
you do this
y=z
z=-y
no rotation of 90 degrees can make you go from left to right hand.
I ran into a similar issue when working with cinema4d and blender. In cinema4d Y is the up axis and rotations are heading,pitch and bank.
Blender's system looks like a right handed system, but rotated by 90 degrees on x axis.
I did the same thing for coordinates(exported as vertex.x,vertex.z,vertex.y). For rotations,
I think you should add 90 degrees(math.pi * 0.5) for rotations on X axis and the rest should be fine.
HTH
Have you tried just using Select All (the 'a' key) and then r x 90 to rotate everything 90 degrees around the X axis and the pivot point? (your pivot point is choosable in the menu bar of the 3D view if you need to control that).
You could do that, export, and then undo.
Just Download Wings3D. Export from Blender as .3ds and then Import this file in Wings3D.
Now you can just export it from Wings3D, again to .3ds. But instead of clicking directly on .3ds, click on the small icon in the right of the ".3ds" menu. now you can unchecked the Box Swap y und z axis and import the .3ds in another program.
There is no way that would be possible. Coordinate system was innately selected as hard coded from the blender source and there are no explicit option has been made in blender to switch it. It would also affected many of the hard coded functionality of any function blender was used or has been made by assume that coordinate
However, in theory, it would be possible to access blender source code and rebuild the blender to have it use another coordinate we would like. Albeit we need to carefully swap everything related to coordinate system
I too wish that left handed coordinate system (as of Unity3D) would be industrial standard and blender should at least have another version that work in left handed coordinate. People should just graduated from table coordinate to screen coordinate already
In blender, you could add empty plain axes, that will correct your orientation when exporting to unity, or try exporting as fbx file and change orientation in export options