DDoS

Member

14

Community Reputation

312 Neutral

• Rank
Member

i'd suggest to transform the points first by the view*model matrix, then make dot product of the point (normalized) with the view direction, probably (0,0,-1) to your solution: float k = dot(diff, vec3(-1.0f, 0.0f, 0.0f)); gives you: k = |diff| * cos(angle_between_vectors) so this is actually a projection and not the angle you want, to erase the impact from the length of diff normalize diff first.
2. how to pass variables among vertex, geometry and fragment shaders

Sponji is right, vec4(normal, 1.0f) actually translates your normales too, you could also pass the normal matrix as a 3x3 matrix into the shader
3. Physx - concave mesh

hi, we're using physx for a small racing game. since our cars are working now we want to include a mesh for the racing track I know i can do that with a height field, but i'd prefer to import a (convex) triangle mesh. since the complete "racing level" is a concave mesh (and physx only likes convex meshes) i guess i have to split my static racing level mesh into convex meshes am i correct? how can i achieve that ?
4. glGetError() INVALID_OPERATION (1282)

most likely you forget to bind some necessary data to the current shader, pls post your code render for debugging with glPolygonmode in wireframe, helps alot (and dont use black as background color ;D )
5. Sobel edge detector

you have to combine vertical and horizontal detectors: http://en.wikipedia.org/wiki/Sobel_operator   use Gx and Gy as described to compute vertical and horizontal gradients then combine those to the gradient G= sqrt(Gx² + Gy²) or a approximated gradient G= |Gx|+|Gy| (much faster)
6. Importing Pieces into OpenGL

you could use assimp :) supports alot of 3d formats http://assimp.sourceforge.net/main_features_formats.html   as a beginner i'd recommend using non interleaved buffers, because you can get into troubles with offsets those are my achievements from the last 2 weeks with learning opengl :)
7. Custom 3D graphics engine

according to your first code you want "perspective", means you need a perspective transformation, which is not an affine transformation, so you have to use homogenous coordinates you should setup a basic rendering pipeline to transform you vertices (lineendpoints) to screenspace   vertex position -> view transformation (if you want a moving camera) -> perspective transformation -> homogenize your coordinates -> rasterize your graphics
8. Are there any mods that ease you into 3D Programming?

for collision and transforming 3d stuff i'd recommend linear algebra lessons ^.^ to get started don't use opengl or directx stuff, it's just frustrating, use (if you want to learn about 3d graphics) a rendering engine like ogre3d(c++) or jmonkeyengine(java) pick something that supports a programming language you already mastered. i don't recommend using udk or unity because in my opinion those engine abstract the whole "3d world" thingy to a pretty high level, which would result in learning how to use a particular game engine and not learning about 3d graphics   ogre and jmonkey abstract this also, but to an intermediate level, where you don't have to deal with opengl/directx and displaying single triangles in the beginning, you can start off learning how to use a scenegraph and stuff to display and transform objects in 3d space   well that's how a began graphics programming in school ^.^ now i study media informatics at technical university in vienna and learn about all the details behind the scenes, like programming opengl and mathematics
9. Extract vectors out of matrix?

It's totally possible, but too complicated to be useful http://callumhay.blogspot.co.at/2010/10/decomposing-affine-transforms.html http://en.wikipedia.org/wiki/QR_decomposition http://en.wikipedia.org/wiki/Polar_decomposition   where would you use this ?
10. Can't properly fill my polygon

use the scanline algorithm, it's alot faster than filling every triangle
11. ray-plane collision

yes this is correct, since dot product is distributive you can write t = dot(a-e.n) / dot(d,n) ddos edit: http://en.wikipedia.org/wiki/Line-plane_intersection -> Algebraic form
12. Software Renderer, silhouette refinement

hi, i'm working on an exercise for university and we are implementing a software renderer in java. they want us to implement some cool stuff we want, and to play around with it i thought about implementing silhouette refinement (just because i think it's interresting), saw this here: http://www.youtube.com/watch?feature=player_detailpage&v=nMwk2Zi0c3o#t=39s how would you implement this method? i googled around and found this: using some kind of adaptive tessaltion on the silhouette tris/edges thought about implementing an own rasterizer and use polynomial curves instead of straight lines on the outer edges, could this work ^^? pls throw in your ideas, and give me stuff to melt my brain with kind regards, DDoS
13. Real Life Simulation MMORPG

....olololololololoooooo xD
14. How to match a 2d pattern in a 2d array?

i think brute force is not the fastest method possible, but it's the easiest to implement. how are you storing your data? an adaption of a text search algorithm like boyer moore could be faster, also clustering the 0,1 into integers, and compare at integer level would be alot faster if you need all matches of the pattern i'd use 2d convolution on the input data, with the pattern as filter kernel. if your data is really really huge you can also speed up the convolution by fourier transform...