• Content count

  • Joined

  • Last visited

Community Reputation

438 Neutral

About _Unicron_

  • Rank
  1. Color works well as Ashaman states. Alternatively you could draw a small line segment for each of normal on a mesh.
  2. Cache coherence and containers

    We still need more information about how you are using the map to give you a helpful answer.   Do you really need to put the pointers to the vector elements in the map? You are trying to setup the map so that you can iterate over to give the same sequence as the vector. In doing this, you propose to store a pointer to each element, this means that you need to do a pointer dereference for every element in the vector. Can you not simply iterate over the vector and then the map or vice versa? Can the elements in the map not be added to the vector?   You mention cache coherence so I'm assuming this is for performance purposes? Have you got a performance problem that needs resolving? Have you used a profiler to ensure you are 'optimising' the correct part of your program?
  3. c++ Performance boost needed

      operator[] does not does not do bounds checking on a std::vector, the at(size_t) member function does do bounds checking and will throw an out_of_range exception. As for it not being inlined. As for inlining as asked by OP, this would vary from compiler to compiler. operator[] is a trivial function and I doubt the fact it is in a loop would prevent it being inlined. You would have to check the assembly code.   Also it's worth repeating what has already been said, when you are really aiming for performance gains a good profiling tool is an absolute must!
  4. Hi all,   I am proud to present Connectrix. This project was completed by a team of 2 and took over a year to develop -- trying to find time alongside full-time jobs, theses, new family....   Connectrix is straight forward to play. Tap the boxes as they fall to rotate them and cycle through its colors. Try to connect boxes of the same color to destroy them.    Features: - Game center achievements and leaderboards - iCloud synchronisation of completion data and stats across your devices - Universal app - 3 game modes - 3 explosive power-ups - No in app purchases   https://itunes.apple.com/us/app/connectrix/id877338578?ls=1&mt=8   The implementation features a mix of cocos2d and raw OpenGL ES.   If anyone wants more detail or has any comments, please let me know     [attachment=21863:Screenshot1_iPhoneRetina3-5Inch.png]   [attachment=21864:Screenshot3_iPhoneRetina3-5Inch.png]    
  5. Hybrid ortho/perspective view frustum

    Thanks Brother Bob, you're right. I was initially thinking that this would be possible to construct just by modifying the projection matrix. Doing the perspective divide in the vertex shader only on the x, z and w components did the trick!
  6. I am trying to create an effect where the view frustum provides a perspective effect along the x-axis, but an orthographic effect along the y-axis. Think of a perspective view frustum but where the top and bottom faces run parallel to each other. Does anyone know how I an achieve this effect?
  7. captcha bypass

    [quote name='yewbie' timestamp='1315348424' post='4858375'] Just some thoughts. Edit: color blind co-worker says color based chaptcha replacements annoy him, just throwing that out there. [/quote] Yes, the last thing you need is a bot beating a human
  8. Legalizing my Game

    [quote name='freddyscoming4you' timestamp='1314816516' post='4856005'] I seriously got negged for that? Wow... someone needs to lighten up. *preps for another neg on this post. weeeee* [/quote] OFF TOPIC How do you even give a neg vote now? I didn't think it was possible. I thought we adopted the 'like' culture. ON TOPIC I'm not involved in your project and dont know the finer details. However, as an outsider, it feels like you are trying to screwing your colleagues over somewhat. It looks like you have outsourced the work you couldn't undertake yourself and now you want to reap the majority of the benefits and pass on as little as possible to the other contributers. I don't mean to sound like an ass but I think everyone should be fairly compensated. You don't mention any percentages so could I be completely off the mark but saying "[color=#1C2837][size=2]I want to make sure that when I sell this game, all the profits will go to me, then I will pay my 'team' according to their effort" sounds like you will be taking the vast majority. I think you should show more respect to the rest of the team and hopefully you will work on more projects in the future [/size][/color] I must also add, congrats on taking a project this far though
  9. Simple graphics running very slow

    [quote name='holtaf' timestamp='1309978404' post='4831910'] Yes I want do draw one quad to whole screen. Sorry I can't post my whole code it's very big! [/quote] We don't need your entire code, but an outline of the loop that runs every frame and your rendering function will help us to help you
  10. [quote name='broady' timestamp='1309971708' post='4831870'] Thanks mate it worked. Where is defined the CTRL+F5 shortcut? Thanks a lot. [/quote] You can see if in the Debug drop-down menu. Or do you mean where is the keyboard mapping defined? If so : Tools->Customize, Click the keyboard button. Scroll down to Debug.StartWithoutDebugging in the next window and you can see the keyboard shortcut and change it if you wish. [quote name='broady' timestamp='1309971708' post='4831870'] EDIT: if i build and run my project from outside the ide its equal to launching with CTRL+F5 from inside VS? [/quote] Yes
  11. How are you running your app? If from within the IDE make sure you use CTRL-F5 (start without debugging) as opposed to just F5 (Debug).
  12. Atmospheric Scattering

    I have fixed the problem It turns out it was actually working. I wasn't positioning the camera correctly in the sky dome. I moved the dome down and things looked a lot better. The sky color looks a little dark at the moment but I'm sure that's fixable [img]http://cs.swan.ac.uk/~cstony/AS2.png[/img] [img]http://cs.swan.ac.uk/~cstony/AS3.png[/img]
  13. Atmospheric Scattering

    [font="arial, verdana, tahoma, sans-serif"][size="2"][quote name='bluntman' timestamp='1309538004' post='4830070'] Try moving the camera height up a bit from the inner radius, like + 0.1 maybe. [/quote] Hi Bluntman, I have tried as you have suggested and the result is basically the same, the only difference is the little patch of blue that you can see in the image I posted is a little darker. P.S The planet rendering link in your sig is very nice, I'm jealous [/size][/font]
  14. Atmospheric Scattering

    Update: I'm not sure if I'm looking in the right place but small changes to the size of skydome result in drastic changes to the output (nothing that looks anything like correct through). Although I thought this was set correctly. Unless I'm missing something subtle?
  15. I'm trying to implement atmospheric scattering using O'Neill's algorithm from GPU gems 2. I only need to render the atmosphere from the ground. To do this I create a half sphere of radius 6.53745. In the shaders I have hard-coded all of the parameters while I try and get something working. Due to the player remaining at ground level I have also hard-coded the camera position within the vertex shader to be at the planet radius. Here is the vertex shader (GLSL): [code] uniform mat4 mvp; uniform mat4 mv; const vec3 v3CameraPos = vec3(0.0, 0.0, 6.378); // The camera's current position const vec3 v3LightPos = normalize(vec3(0.0, 0.0, 1.0)); // The direction vector to the light source const vec3 v3InvWavelength = vec3(1.0 / pow(0.650, 4.0), 1.0 / pow(0.570, 4.0), 1.0 / pow(0.475, 4.0)); // 1 / pow(wavelength, 4) for the red, green, and blue channels const float fCameraHeight = 6.378; // The camera's current height const float fCameraHeight2 = 6.378 * 6.378; // fCameraHeight^2 const float fOuterRadius = 6.53745; // The outer (atmosphere) radius const float fOuterRadius2 = 6.53745 * 6.53745; // fOuterRadius^2 const float fInnerRadius = 6.378; // The inner (planetary) radius const float fInnerRadius2 = 6.378 * 6.378; // fInnerRadius^2 const float fKrESun = 0.0025 * 15.0; // Kr * ESun const float fKmESun = 0.0015 * 15.0; // Km * ESun const float fKr4PI = 0.0025 * 4.0 * 3.1415; // Kr * 4 * PI const float fKm4PI = 0.0015 * 4.0 * 3.1415; // Km * 4 * PI const float fScale = 1.0 / (6.53745 - 6.378); // 1 / (fOuterRadius - fInnerRadius) const float fScaleDepth = 0.25; // The scale depth (i.e. the altitude at which the atmosphere's average density is found) const float fScaleOverScaleDepth = (1.0 / (6.53745 - 6.378)) / 0.25; // fScale / fScaleDepth const int nSamples = 2; const float fSamples = 2.0; varying vec3 v3Direction; float scale(float fCos) { float x = 1.0 - fCos; return fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25)))); } void main(void) { // Get the ray from the camera to the vertex, and its length (which is the far point of the ray passing through the atmosphere) vec3 v3Pos = gl_Vertex.xyz; vec3 v3Ray = v3Pos - v3CameraPos; float fFar = length(v3Ray); v3Ray /= fFar; // Calculate the ray's starting position, then calculate its scattering offset vec3 v3Start = v3CameraPos; float fHeight = length(v3Start); float fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fCameraHeight)); float fStartAngle = dot(v3Ray, v3Start) / fHeight; float fStartOffset = fDepth*scale(fStartAngle); // Initialize the scattering loop variables float fSampleLength = fFar / fSamples; float fScaledLength = fSampleLength * fScale; vec3 v3SampleRay = v3Ray * fSampleLength; vec3 v3SamplePoint = v3Start + v3SampleRay * 0.5; // Now loop through the sample rays vec3 v3FrontColor = vec3(0.0, 0.0, 0.0); for(int i=0; i<nSamples; i++) { float fHeight = length(v3SamplePoint); float fDepth = exp(fScaleOverScaleDepth * (fInnerRadius - fHeight)); float fLightAngle = dot(v3LightPos, v3SamplePoint) / fHeight; float fCameraAngle = dot(v3Ray, v3SamplePoint) / fHeight; float fScatter = (fStartOffset + fDepth*(scale(fLightAngle) - scale(fCameraAngle))); vec3 v3Attenuate = exp(-fScatter * (v3InvWavelength * fKr4PI + fKm4PI)); v3FrontColor += v3Attenuate * (fDepth * fScaledLength); v3SamplePoint += v3SampleRay; } // Finally, scale the Mie and Rayleigh colors and set up the varying variables for the pixel shader gl_FrontSecondaryColor.rgb = v3FrontColor * fKmESun; gl_FrontColor.rgb = v3FrontColor * (v3InvWavelength * fKrESun); gl_Position = mvp * gl_Vertex; v3Direction = v3CameraPos - v3Pos; } [/code] and the fragment shader: [code] const vec3 v3LightPos = normalize(vec3(0.0, 0.0, 1.0)); const float g = -0.95; const float g2 = -0.95 * -0.95; varying vec3 v3Direction; void main (void) { float fCos = dot(v3LightPos, v3Direction) / length(v3Direction); float fRayleighPhase = 0.75 * (1.0 + fCos*fCos); float fMiePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos*fCos) / pow(1.0 + g2 - 2.0*g*fCos, 1.5); gl_FragColor = fRayleighPhase * gl_Color + fMiePhase * gl_SecondaryColor; } [/code] This is the output I get (when looking up). Just a hit of blue at the top of the sky dome and a grey-white color everywhere else: [img]http://cs.swan.ac.uk/~cstony/AS.png[/img] Can anyone see where I am going wrong?