Jump to content

  • Log In with Google      Sign In   
  • Create Account

Icebone1000

Member Since 26 Feb 2009
Offline Last Active Yesterday, 04:47 PM

Topics I've Started

What field of study deals with articulation(joints) efficiency/practicality design, to...

01 February 2016 - 02:53 PM

When I search about robotics, lots of stuff comes up, what never comes up is the robots actual design, and by that I dont even mean how cute or stylish it looks, I mean the actual structure design.

 

I have special interest in know how they come up with the best joints for the best task, like "oh, i need x degrees of freedom here, but it needs to support y weight, so since Im limited to materials s and z, I think joint j will do the work".

 

Is it mechanical engineering? is it industrial design? is it not really present in a single field? I mean, robotics is pretty generic and deals with a million of different stuff.

So, say a team is making a robot, say something like big dog, how/when exactly the joints gets decided..?

 

Say I want a biped robot capable of walking trough rough loose rock terrain, how do I decide the best kinda of legs..I know these answer are not simple (theres not even a robot capable of that, for what I know), I just have no idea what fields of study deals with those.


How to pin zoom at location

30 July 2015 - 08:28 AM

I have a map that I can scroll (drag with mouse) and zoom.

Im trying to implement this function: 

static void PinScrollZoomAtMapPos(Vector2 mapPos_p, ScrollRect scroll_p)
    {
        // this is to make a point on the map always in the same place on the
        // screen, regardless of current zoom

        Vector2 scrolledMapPos = new Vector2(
               mapPos_p.x + scroll_p.content.localPosition.x,
               mapPos_p.y + scroll_p.content.localPosition.y
               );

        Vector2 scrolledZoomedMapPos = new Vector2(
               mapPos_p.x * scroll_p.content.localScale.x + scroll_p.content.localPosition.x,
               mapPos_p.y * scroll_p.content.localScale.y + scroll_p.content.localPosition.y
               );

        Vector2 diff = scrolledMapPos - scrolledZoomedMapPos;

        Debug.Log("diff: " + diff);

        Vector2 offseted = new Vector2(
            scroll_p.content.localPosition.x + diff.x,
            scroll_p.content.localPosition.y + diff.y
            );

        scroll_p.content.localPosition = offseted;
    }

(The scroll_p.content is the map.)

 

Although I think my logic makes sense at first, I see how it will never work, the 'diff' var should return 0 after subsequent calls to this function, but since I move the map pos, it will never happen. I dont know what I have to do..

 

Now doing this:

static void PinScrollZoomAtMapPos(Vector2 mapPos_p, ScrollRect scroll_p)
    {
        // this is to make a point on the map always in the same place on the
        // screen, regardless of current zoom

        //Vector2 scrolledMapPos = new Vector2(
        //       mapPos_p.x + scroll_p.content.localPosition.x,
        //       mapPos_p.y + scroll_p.content.localPosition.y
        //       );

        Vector2 scrolledZoomedMapPos = new Vector2(
               mapPos_p.x * scroll_p.content.localScale.x + scroll_p.content.localPosition.x,
               mapPos_p.y * scroll_p.content.localScale.y + scroll_p.content.localPosition.y
               );

        Vector2 diff = mapPos_p - scrolledZoomedMapPos;

        Debug.Log("diff: " + diff);

        Vector2 offseted = new Vector2(
            scroll_p.content.localPosition.x + diff.x,
            scroll_p.content.localPosition.y + diff.y
            );

        scroll_p.content.localPosition = offseted;
    }

Works, but the map becomes un-scrollable. I want to account only for zoom, like ignore the displace caused by the zoom (since it enlarges the map from the center).

 

Note this is different from centralizing the map at pos. The pin can be at any place, for example at 80% bottom right of the screen, say theres a city there, I want the city to keep at the exact same place on the screen, while I zoom in/out.

 

I feel is such a simple thing to do,yet Im struggling with this since yesterday.

 

 

 

 

 

 

 


Why no Constant Buffer offsets like for Vertex Buffers?

29 June 2015 - 12:15 PM

This might sound stupid..I was reviewing my instanced sprites code, and something bothered me..

 

[its not about instancing, just the overall architecture/usage of cbuffers]

 

With a draw call I can say which piece of a vertex buffer to use. Meaning I can let it there and use it multiple times by saying offset and number for each drawable..ok

 

So, Instead of having a "drawable" cbuffer for each drawable/'renderable unit', or sharing one between multiple ones and remap it everytime (which is bad due syncing), why cant I just allocate a huge ass cbuffer and use it in slices just like vertex buffers? I could allocate a cbuffer for all my sprites, have each sprite hold an offset, and only map it once per frame..

 

So on the draw call I could have extra params for the cbuffers.

Well, I see you can have lots of different cbuffers on a shader, but its nothing a description structure couldnt solve. (actually, I think an array with offsets for each cbuffer would be enough)

 

Why the difference?

I hope Im making sense. This stuff is again cold in my head.


Ideal chair?

16 January 2015 - 05:09 PM

I never really bothered with this...but my chair sucks, its not comfortable, and I spend too much time on it...

 

Whats the best kind of chair to get long hours programming on?


How to apply Alpha Masks that move around and affect only specific objects (no fullscre...

19 August 2014 - 08:19 PM

Imagine a tiled 2D game where your character goes behind a wall (found a secret spot). Say I want to apply an alpha mask (a circle with faded borders) in the same position the player is, but only for the tiles/sprites hiding the secret spot, not for surrounding environment tiles (where the mask will overlap (due its big size) but not affect, cause theres notting behind then, its a solid wall)

lFgxXkS.png

check how the mask affects only specific tiles

 

Whats the best way to accomplish that?

 

#1# With stencil buffer Id need to render in lots of passes. (I suppose, I dont remember have ever used the stencil buffer before)

Render unaffected tiles + player;

Render the mask in the player position to the stencil buffer;

Render the tiles hiding the secret spot;

 

#2# With specific pixel shader:

Render unaffected tiles + player;

Render the tiles hiding the secret spot w/ a specific pixel shader, that also takes the mask and its screen position.

 

Which method is better?

The pixel shader method sounds better to me, but I dont know how/if it would work.

Id need to check if it overlap with the mask (comparing SV_Position witht the given mask screen position constant), and compute the equivalent uv on the mask..?

 

Computing the equivalent mask uv would be something like

mask uv: (mask_pos - SV_Position) / mask resolution?

What if the current pixel does not overlap (generating negative uvs, or greater than 1)? (if the mask is constrained to have black on the borders than clamping the computed uv to [0,1] would work I guess?)

 

Would #1 or #2 work?

Any better way of doing this?


PARTNERS