Jump to content
  • Advertisement

qxsl2000

Member
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

124 Neutral

About qxsl2000

  • Rank
    Newbie

Personal Information

  • Interests
    |programmer|
  1. array of points(green dot) connected into a curve line,It was just nothing more than array of points arranged in order , order of insertion. As shown in the above figure, my goal is for the player to start from "S" and choose a point that is closest to the player and is naturally reasonable(i mean i can't walk through the wall). X by BWPlayer X by BWPlayer X by BWPlayer X by BWPlayer But because the shortest distance between the two points is W, it suddenly move through to the other side, which is definitely not what we want.actually what i desire is "N". any hints on this,look forward to your reply,thank you. Of course, i have used cross-production to determine if the point being chosen is relative to the left-side or right-side of my current location.with points on the right-side of my position has been chosen as candidates,then pick one of them, which is minimum distance compared with others.
  2. thank you. i'm trying it.i guess need tweak to suit to my needs Thank you, i'l study it well.
  3. down votefavorite I am currently developing a game, motorcycle type game. Of course, my map is not just made up of simple line or curve. For example: a vertical circular track in the map. i've seen most 2D motorcycle games have this design. How do you prevent the motorcycle from falling off the vertical circular track by correlating the motorcycle's forward speed? If the forward speed is 0, it will fall down naturally, because this is the physical essence, but if the speed is fast enough, it should firmly grasp the track and not fall down. so how to exert force on it? what's math behind it? looking forward to your reply,i really appreciate it, thank you!
  4. Recently I've read a few articles about drawing trapezoid on the Internet, which it solved the problem of  wrong  perspective over texture mapping between two triangles by using homogeneous coordinate  stq (leave r zero).   It's said that the default 2d uv(0,0) ==> 3d (0,0,width)  homogeneous coordinate,  and 2d uv(0,1) ==> (0, width,width), which the width is length that the texture to be mapped, it 's clear that after divide by the the w(or q) the interpolated texture coordinate  is the same as  the original uv coordinate.  i need to know why is it? how does it works? cause i can't figure out the subtle difference in between, or math behind it.   Could your guys explain in detail. i really appreciate it! thank you!
  5. This may be 'Triplanar mapping.' https://gamedevelopment.tutsplus.com/articles/use-tri-planar-texture-mapping-for-better-terrain--gamedev-13821   I just took this screenshot in 3d paint to show triplanar. You get a good mapping when aligned with the 3 axes (front, side, top) but between you get a blend, which can look bad with some textures but not so bad with other less patterny textures.     The best answer may depend on what you are using it for. Some possibilities aside from usual uv unwrapping and procedural texturing are 'ptex': http://ptex.us/   Or lightmap type packing, where you don't share uvs between triangles. In this case you can just orientate your uv coords exactly to the 3d triangle plane, and you have to orientate it to get it to pack decently onto a uv map. But there may be other issues to deal with, such as bleedover at the side of triangles from texture filtering / mipmapping, which standard uv unwrapping islands mostly deals with automagically.       yes, thank your patience and reply, i think it's indeed what i'm looking for.but as what you said, some flaws inside it. could you explain in detail. thank you.  
  6. Hello,guys. is there some texture mapping tech taking account of  vertices of curved mesh as input  to calculate it's uv coordinate with respect to the z component, and even angle viewed from, instead of generalized uv mapping as usual, just like f(x,y,z)==>(u,v),which the function results in uv output with respect to it's perspective.   hope your guys give me some hints.thank you!
  7. Thank you. That's clear answer. just another question out of my mind. how's the handedness (right or left hand) of the matrix.if i prefer one over another, how to do the conversation between them?
  8. Thank your reply. yes.i think i got it. good opinion about optimization stuff.i 'll keep it in my mind!
  9. Hello guys.I've formerly seen someguy's shader snippet, that the composed TBN matrix was used to transform the attribute a_pos.but obviously it's not related to bump-maping,or anything else. could this be rotation matrix made from input parameters of the shader? those vectors(normal,binormal,tangent) are nothing more than three bases, aren't they? I mean the TBN matrix of the shader is not used to be the TBN matrix applied on bump-maping ever (as you know, to transform a vector to vector in tangent space,or to transform vector in tangent back using inverse of TBN matrix), and there 's no light calculation involved in,but it directly transform position attribute instead. Really a little bit confusion in my mind. Hope your guy help me get through it. i really appreciate it. sorry for my bad english,thank you! Here's the vertex shader, as the following: #ifdef GL_ES #else #define highp #define mediump #define lowp #endif uniform mat4 u_mvp; attribute vec3 a_pos; attribute vec3 a_normal; attribute vec2 a_uv0; attribute vec2 a_uv1; varying vec2 v_texcoord0; varying vec2 v_texcoordMap; uniform highp float u_time; uniform mediump float u_1DivLevelWidth; uniform mediump float u_1DivLevelHeight; void main() { float mapPos = a_normal.x * 0.1 + a_normal.y * 0.6; vec2 v1 = vec2(cos(mapPos + u_time * 0.6), cos(mapPos + u_time * 0.9)); mapPos = (a_normal.x + a_normal.y + a_pos.x + a_pos.y) * 3.0; vec2 v2 = vec2(cos(mapPos + u_time * 3.2 + (a_uv1.y * 0.1)), cos(mapPos + u_time * 2.9 + (a_uv1.y * 0.1))) * 0.02 * a_uv1.y; vec3 normal = normalize(vec3(v1 * (a_uv1.x * 0.2), 5.0)); //vec3 normal = vec3(0.0, 0.0, 1.0); vec3 binormal = normalize(cross(normal, vec3(1.0, 0.0, 0.0))); vec3 tangent = normalize(cross(binormal, normal)); // to transform the position using the above TBN matrix // what's the TBN matrix meaning for vec4 pos = vec4((a_pos * mat3(tangent, binormal, normal)) + a_normal, 1.0) + vec4(v2 * (a_uv1.y * 0.2), 0.0, 0.0); gl_Position = u_mvp * pos; v_texcoord0 = a_uv0; v_texcoordMap = vec2(pos.x * u_1DivLevelWidth, pos.y * u_1DivLevelHeight); }
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!