Jump to content
  • Advertisement

tracegame

Member
  • Content Count

    64
  • Joined

  • Last visited

Community Reputation

169 Neutral

1 Follower

About tracegame

  • Rank
    Member

Personal Information

  • Role
    Programmer
  • Interests
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Just reply in another thread,check here.
  2. tracegame

    XNA SpriteBatch depth with 3D objects

    Not sure if my reply is useful. And I don't know if monogame is open source.Known this from your other post. But just want to say,I have some experiment of FNA which is a open source XNA. Work the same way as XNA. With FNA you can trace function with break point and see where it goes. So you know DX and C++ and you know those 3D rules,you may want to trace the source code and see how it works. Then figure out how to do it.Also about how to use UnloadContent. If you have ever played other XNA or XNA like framework game. You can check their decompiled source code for reference. There are still a lot of XNA family game. Such as Celeste Saltand Sanctuary Stardew Valley Check and learn their coding style may help.
  3. tracegame

    Sprite Sheet Clipping Programs

    Unity3D has auto slice sprite sheet,but not very good at dealing with small pieces,such as parts of character. Eyes,hands,legs,mouth...ect.usually generated from spine animation atlas. May generate lots of junk. Full Sprite sheet like character animation is OK. Anyway you should try. With that auto slice and some C# code,may help you a little bit to cut sprite sheet into pieces. Don't know where you get your sprite speet. Memory,internet that other people combine,extract from game assets package? If you extract those assets from memory or game assets,you probably want to find the UV description file(txt, json,xml...ect), because they can give you the real info you need to rip out perfect sprite. Without that you're ripping out sprite the hard way.
  4. Trying to make a mini puzzle game,like tearing a photo into pieces. The way I can think of is to calculate those pieces of image distance. If the puzzle image is correctly solved. Distances between piece 1 and others should approximate be some fixed values. Some error distance 5 or 10 should be allowed. Question is I don't if there are any other better way to do this. What puzzle game like this usually do to solved Irrregular shape match problem? Pieces don't need to be at the extract right location.Small gaps should be allowed.
  5. tracegame

    PS_2_0 Asm Shader sincos question

    OK,thank you,didn't notice there are useful explaination below...
  6. I am trying to transfer a XNA PS shader to HLSL.And maybe try to transfer to GLSL. New to ASM Shader and got this sincos function,no idea what does it mean. sincos r1.y, r0.x, c9, c10 according to MS doc https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/sincos---ps c9,c10 are const which define like this #define D3DSINCOSCONST1 -1.5500992e-006f, -2.1701389e-005f, 0.0026041667f, 0.00026041668f c9 = D3DSINCOSCONST1 #define D3DSINCOSCONST2 -0.020833334f, -0.12500000f, 1.0f, 0.50000000f c10 = D3DSINCOSCONST2 r1.y is dest r0.x is source So,what does this line mean?How do I know it is sin function or cos function for HLSL? And here is the full PS ASM code from Intel GPA. // // Generated by Microsoft (R) HLSL Shader Compiler 9.26.952.2844 // // Parameters: // // float fTimer; // float stop; // // // Registers: // // Name Reg Size // ------------ ----- ---- // fTimer c0 1 // stop c1 1 // // preshader // mul c0.x, c0.x, (0.15) // add r0.x, c1.x, (-1) // mul c1.x, r0.x, r0.x // neg r0.x, c1.x // add c2.x, r0.x, (1) // // approximately 5 instructions used // // Generated by Microsoft (R) HLSL Shader Compiler 9.26.952.2844 // // Parameters: // // sampler2D ColorMapSampler; // float x; // float y; // // // Registers: // // Name Reg Size // --------------- ----- ---- // x c3 1 // y c4 1 // ColorMapSampler s0 1 // ps_2_0 def c5, 0.600000024, -0.0529000014, 22, 0.319999993 def c6, 0.159154937, 0.5, 6.28318548, -3.14159274 def c7, 0.416666657, 0.0240000002, 0, 0 def c8, -3, 6, 6, 0 def c9, -1.55009923e-006, -2.17013894e-005, 0.00260416674, 0.00026041668 def c10, -0.020833334, -0.125, 1, 0.5 dcl t0.xy dcl_2d s0 mov r0.w, c5.z mad r0.x, t0.x, r0.w, c0.x mad r0.x, r0.x, c6.x, c6.y frc r0.x, r0.x mad r0.x, r0.x, c6.z, c6.w sincos r1.y, r0.x, c9, c10 mul r0.x, r1.y, c5.w add r0.y, t0.y, -c4.x mul r0.y, r0.y, r0.y mul r0.y, r0.y, c5.x add r0.z, t0.x, -c3.x mad r0.y, r0.z, r0.z, r0.y mad r0.z, r0.y, -c7.x, c7.y mad r1.x, r0.x, r0.z, t0.x mad r0.x, t0.y, r0.w, c0.x mad r0.x, r0.x, c6.x, c6.y frc r0.x, r0.x mad r0.x, r0.x, c6.z, c6.w sincos r2.y, r0.x, c9, c10 mul r0.x, r0.z, r2.y mad r1.y, r0.x, c5.w, t0.y add r0.x, r0.y, c5.y add r0.y, -r0.y, -c5.y mul r2.xyz, r0.y, c8 cmp r1.xy, r0.x, t0, r1 texld r1, r1, s0 mov r2.w, c7.z add r2, -r2, r1 cmp r0, r0.x, r1, r2 add r1.xyz, -r0, c2.x abs r1.xyz, r1 cmp r0.xyz, -c1.x, r0, r1 mov oC0, r0 // approximately 47 instruction slots used (1 texture, 46 arithmetic)
  7. tracegame

    How to understand this GLSL shader?

    Thank you all,with document I could use this happily and no worry. Thank you all,with document I could use this happily and no worry.
  8. https://glslfan.com/?channel=-L_NAXqFFl9RAZ2eBIaH This is a web GLSL shader effect. Maybe can't be loaded on some browser or old ones. Anyway if your browser support compiled, it will show. Full code here #version 300 es // - glslfan.com -------------------------------------------------------------- // Ctrl + s or Command + s: compile shader // Ctrl + m or Command + m: toggle visibility for codepane // ---------------------------------------------------------------------------- precision mediump float; uniform vec2 resolution; // resolution (width, height) uniform vec2 mouse; // mouse (0.0 ~ 1.0) uniform float time; // time (1second == 1.0) uniform sampler2D backbuffer; // previous scene out vec4 fragColor; void main() { int t = int(time*12.0); vec2 uv = (gl_FragCoord.xy*2.0-resolution.xy)/resolution.y; ivec2 p = ivec2(pow(abs(uv*32.0),vec2(0.4))*16.0); int ptn = int(time*0.1)%3; int q = int[](p.x|p.y, p.x&p.y, p.x^p.y)[ptn]; t = (t&63^t<<q*(t%9)) |(t&63|t<<q*(t&7)) ^ (t*2*(t&63|t<<q*(t&15))); float x = float((t>>0&15)+(t>>4&15)+(t>>8&15))*0.1; vec3 col = vec3(0.7,0.2,0.1)*fwidth(x); fragColor = vec4(col,1); } My question is there is a line. int q = int[](p.x|p.y, p.x&p.y, p.x^p.y)[ptn]; Looks like dynamic array,but what does the content inside () mean? Is it init list or something else? And this code compile successfuly. So I think the grammar is correct,but I never seen or learn anything about something like this. Could someone explain why this is correct and what does it mean? And is there some document or example teach or show you that you can use it like this? Need more example
  9. Imgui can use image button and translucent background which you may need. Years ago I think people use CEGUI and MyGUI,you may want to look if interested
  10. You can try youtube tutorial if you like,better for beginner,teach you from how to install opengl and how to debug step by step. More useful for beginner.
  11. Waste one day on this function and get nothing. The only example I found on github is this example. https://github.com/multiprecision/sph_opengl It does work but lack of example about updating Uniform buffer. When I got something like this #version 460 uniform UniformBufferObject { mat4 model; mat4 view; mat4 proj; }ubo; layout (location = 0) in vec3 aPos; layout (location = 1) in vec2 aTexCoord; layout (location = 0) out vec2 TexCoord; out gl_PerVertex { vec4 gl_Position; }; void main() { gl_Position = ubo.proj * ubo.view * ubo.model * vec4(aPos, 1.0f); TexCoord = vec2(aTexCoord.x, aTexCoord.y); } I can not pass model,view,proj matrix to shader correctly in cpp. The old version 330 from LearnOpengl will work for non binary shader,glShaderSource from text will work. But I really want to try to use glShaderBinary #version 330 core layout (location = 0) in vec3 aPos; layout (location = 1) in vec2 aTexCoord; out vec2 TexCoord; uniform mat4 model; uniform mat4 view; uniform mat4 projection; void main() { gl_Position = projection * view * model * vec4(aPos, 1.0f); TexCoord = vec2(aTexCoord.x, aTexCoord.y); } This shader format does not compile with glslangValidator. https://github.com/KhronosGroup/glslang So I have to use that 460 version and don't know how to pass matrix to it correctly. I tried to use Uniform buffer,map,unmap,not work. glBindBuffer(GL_UNIFORM_BUFFER, UBO); GLvoid* p = glMapBuffer(GL_UNIFORM_BUFFER, GL_WRITE_ONLY); memcpy(p, &uboVS, sizeof(uboVS)); glUnmapBuffer(GL_UNIFORM_BUFFER); and glGetUniformLocation always return -1,no matter what name I use glGetUniformLocation(xxx,"ubo") glGetUniformLocation(xxx,"UniformBufferObject") glGetUniformLocation(xxx,"model") All Fail. if I change gl_Position = ubo.proj * ubo.view * ubo.model * vec4(aPos, 1.0f); to gl_Position = vec4(aPos, 1.0f); Then the shader works,which means all the matrix not pass to shader correctly and they are all Zero I think. So anybody know how to use glShaderBinary with glslangValidator updating Uniform buffer on OpenGL? I am not sure if this 460 shader is correct,It just pass glslangValidator compile.
  12. You should try Unity3D official forum to ask your question,I'm sure they DO know better than here. https://forum.unity.com/ Second,Unity3D is much like a cross platform 3D Game Level Editor,you should always write your own code to get special feature. Third,have you read <Realtime Collision Detection> or <3D Game Engine Design>,they just teach you how to check line segment intersection.You can practice to accomplish this in Unity3D within a few hours as I did last year.Also you can write you own Mesh Collision with the knowledge those book privided.
  13. Check out github for opensource projects. If you already read a lot of papers,yet never write any code. Just search those opensource engine,practice projects to start. Can save you a lot of time to build from the ground. Fork and add your own feature. And www.shadertoy.com a lot of interesting and cool examples.
  14. tracegame

    Any DX12 books recommanded?

    Thanks iedoc,not yet. Book intro to DX12,I already got it. I know there are other good DX11 books besides intro to 3D Game Programming with DX11 Just wondering if there are more books about DX12 I can look for.
  15. Is <Introduction to 3D Game Programming with DirectX 12> the only book about DX12? If not, please recommand some DX12 books or series tutorials,better more than 10. And one more question. Right now I'm learning Vulkan,feels much more like DX11 to do the Init thing.Lots of struct to fill. Maybe more like DX12?Haven't touch 12 yet,since IT IS WIN10 only. Is it better to learn Vulkan or DX12 first,or doesn't matter the order.
  • 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!