Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

1454 Excellent


  • Rank

Personal Information

  • Website
  • Industry Role
    3D Animator
    3D Artist
    Art Director
    Artificial Intelligence
    Audio Engineer
    Business Development
    Character Artist
    Concept Artist
    Creative Director
    Environment Artist
    Game Designer
    Level Artist
    Level Designer
    Pixel Artist
    Quality Assurance
    Sound Designer
    Technical Artist
    Technical Director
    UI/UX Designer
    Visual Effects Artist
  • Interests

Recent Profile Visitors

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

  1. Well the main problem is with unprojecting the fragment - im not surenif i donthat correctly, second thing is i do shadowtest enteirly in fragment shader i only pass world vertex position and screen coord to fragment shader
  2. So, algorithm looks like this: Use fbo Clear depth and color buffers Write depth Stretch fbo depth texture to screen size and compare that with final scene GLSL algo looks like this: Project light position and vertex position to screen space coords then move them to 0..1 space Compute projected vertex to light vector Then by defined number of samples go from projected vertex position to projected light position: - Get the depth from depth texture - unproject this given texture coord and depth value * 2.0 - 1.0 using inverse of (model*view)*projection matrix Find closest point on line (world_vertex_pos, wirld light pos) to unprojected point, if its less than 0.0001 then i say the ray hit something and original fragment is in shadow Now i forgot few things, so i'll have to ask: In vertex shader i do something like this vertexClip.x = dp43(MVP1, Vpos); vertexClip.y = dp43(MVP2, Vpos); vertexClip.z = dp43(MVP3, Vpos); vertexClip.w = dp43(MVP4, Vpos); scrcoord = vec3(vertexClip.x, vertexClip.y, vertexClip.z); Where float dp43(vec4 matrow, vec3 p) { return ( (matrow.x*p.x) + (matrow.y*p.y) + (matrow.z*p.z) + matrow.w ); } It looks like i dont have to divide scrcoord by vertexClip.w component when i do something like this at the end of shader gl_Position = vertexClip; and fragments are located where they should be... I pass scrcoord to fragment shader, then do 0.5 + 0.5 to know from which position of the depth tex i start to unproject values. So scrcoord should be in -1..1 space right? Another thing is with unprojecting a screen coord to 3d position: So far i use this formula: Get texel depth, do *2.0-1.0 for all xyz components Then multiple it by inverse of (model*view)*projection matrix like that: Not quite sure if this isneven correct: vec3 unproject(vec3 op) { vec3 outpos; outpos.x = dp43(imvp1, op); outpos.y = dp43(imvp2, op); outpos.z = dp43(imvp3, op); return outpos; } And last question is about ray sampling i'm pretty sure it will skip some pixels making shadowed fragments unshadowed.... Need somehow to fix that too, but for now i have no clue... vec3 act_tex_pos = fcoord + projected_ldir * sample_step * float ( i ); I checked depth tex for values and theyre right. Vert shader
  3. Wasnt that that 0.0 angle wasnrepresented by half of image so whenever thise cartesian coord mean its in the center of image since you have 180 deg move in both horizontal directions and 90 in both vert dirs its pretty straight forward, all you have is to define the rectangle sides

    screen space shadows

    So in other words, for each frame write depth buffer to a texture then draw scene with light/shadow pass and then sample the ray from each fragment towards the light right? ;)
  5. so how exactly you do this kind of efffect, what do you need to draw and what ro compare with, didn't find any good tutorial for that. Do you have to store each fragment position in textures then compare it within fragment shader or what? cheers

    DX11 Gap between Sky and Terrain

    It looks like you are using flat terrain not even scaled to match planet curve/horizon, you could stretch sky or use some kind of skybox

    Kinda navmesh with ability to fall down

    You need to provide more information, in example apicturr of your map and what are you really trying to achieve my guess is that you do what? I dont know drawnscene from top level and process height data? Once again too less info to help you
  8. Ok i get it i pass data without caring about anything but +1 why? Edit i get it null terminated string but its not necesarry for me now since i have my own termination standard lel
  9. I'm trying to send text through sockets (using tcp protocol) Annyway i use write and read routines, lets say like this: int wb = write(sockfd, cmd.c_str(), cmd.length()); Where cmd is std::string, as far i understand c_str() is some char type and i treated it always like char * array, However i dont really think thats the proper type, cause i dont even think there are negative ascii chars anyway i need to pass unsigned chars because i need to send binary data too (as text lol for simplification) So do i need to cast that c_str() thing to unsigned char buffer? And can inise a code like this int cmdlen = TextLength( txt ); unsigned char * pdata = new unsigned char[ cmdlen ]; memcpy(&pdata[0], txt.c_str(), sizeof ( unsigned char ) * cmdlen);

    OpenGL Framebuffer

    I bet you are recreating some arraysbthat you constantly pass to gpu memory, without code we cant help
  11. I removed binary flag and text file saves properly, i use gettext every savetofile func cause i always produce a continous str from std vector anyway dont ask me why thats the approach i chosed,
  12. As you said ofstream doesnt giarantee to be thread safe i tried this code, and it doesnt even save any text all, all i see is blank nothing but the length of a file is set (i see just spaces) inwonder whysthat void SaveToFile(AnsiString fname) { pc = GetText(); FILE* f = fopen(fname.c_str(),"wb+"); int len = pc.length(); char * buff = new char[ len ]; memcpy(buff, pc.c_str(), sizeof(char) * len); fwrite(&buff[0], sizeof ( char ) * len,1,f); fclose(f); }
  13. Ok, but first of all ill have to check out how to use select function, it seems even when it worked in the past im getting errors there, and i know that it should write so thats the big question here may be something with saving function so ill post that typedef std::string AnsiString; #ifndef WINDOWS_CMP struct TStringList #endif { int Count; std::vector<AnsiString> Strings; void Add(AnsiString text) { AnsiString p = text; Strings.push_back(text); Count = Count + 1; } AnsiString GetText() { AnsiString res = ""; int i; for (i=0; i < Count; i++) res = res + Strings[i] + "\n"; return res; } AnsiString pc; void SaveToFile(AnsiString fname) { pc = GetText(); std::ofstream outfile (fname.c_str(),std::ofstream::binary); int len = pc.length(); char * buff = new char[ len ]; memcpy(buff, pc.c_str(), sizeof(char) * len); outfile.write (buff, len); outfile.close(); } }; now where i log that in my server class like it void LOG(AnsiString str) { pstdout.Add(str); pstdout.SaveToFile("/mnt/ext_sdcard/server_log.txt"); } and use it like (ofc in a thread) LOG("TEXT 1"); call some func LOG("TEXT 2"); do other stuff LOG("TEXT 3");
  14. Anyway i'm having problems debugging anything within a thread, i thought i could save a log to a file, but instead of writing text i get blank lines, maybe theres a good way to log a thread?
  15. Server->ProcessFrame(); Is blocking while loop in a thread
  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!