Register  |  FAQ  |  Search  |  Memberlist  |  Usergroups  |  Log in 
Reply to topic
 Cubic rooms 
nigec


Joined: 04 Jul 2007
Posts: 212
Reply with quote
I don't want to hijack the Beta thread so i'll start a new one about this
I tried what Vincent said and got a working cubic room it looks ok if you just pan horizontally


If you pan down you can see the panels distort
The wall is straight on this shot

And bends as you look down


If you want to see the project i can post it

I'm terrible at low poly modeling and texture mapping, hence why i'm going for pre rendered..
View user's profile Send private message
  
Vincent


Joined: 25 Dec 2006
Posts: 296
Reply with quote
Quote:
If you pan down you can see the panels distort
The wall is straight on this shot


Try put camera to the center of the skybox.

If you post the scene, I can check it.
View user's profile Send private message
  
Vincent


Joined: 25 Dec 2006
Posts: 296
Reply with quote
You can use a sphere (mobile) to replace skybox, then pack 6 images to a cube map. Then create a shader file (see below codes), load to a material and apply it to the sphere.

Code:
matrix matTotal; //matWorld*matView*matProj;

   
   // Definition of the vertex shader, declarations then assembly
   VertexShader vsdiffuse =
   decl
   {
   stream 0;
   float v0[3];       // Position
   float v1[3];      // normal
   float v2[2];       // Texture Coord0
   }
   asm
   {
   vs.1.0

   // c0-c3 contains composite transform matrix
   m4x4 oPos, v0, c0   // transform vertices by view/projection matrix
   //m3x3 r0, v1, c4
   mov oT0, v1
   };



technique T0
{
   pass P0
   {
   // stage0
   ColorOp[0] = SelectArg1;
   ColorArg1[0] = Texture;
   // stage1
   ColorOp[1] = Disable;

   MipFilter[0]=None;
   CullMode=None;

   VertexShaderConstant[0] = <matTotal>;   // World*View*Proj Matrix
   VertexShader = <vsdiffuse>;
   }
}
View user's profile Send private message
  
nigec


Joined: 04 Jul 2007
Posts: 212
Reply with quote
Would there be a way to add navagation? like on the scream demo i sent?
basiclly you add coodinates taken from , say the front image

it looks like this:


Code:
-- First node, near the table
   scCreate(SC_NODE, "node1")
   scBegin(SC_NODE) -- Begin creating objects inside this node
       -- Set up the textures (faces) of the cube
       scTexture(SC_FRONT, "node1/node1_f.jpg")
       scTexture(SC_BACK, "node1/node1_b.jpg")
       scTexture(SC_LEFT, "node1/node1_l.jpg")
       scTexture(SC_RIGHT, "node1/node1_r.jpg")
       scTexture(SC_UP, "node1/node1_u.jpg")
       scTexture(SC_DOWN, "node1/node1_d.jpg")
 scCreate(SC_OBJECT, "to_node2")
       scPlace(5, 496, 244, 441, SC_FRONT)
    scOnHover(SC_USE) scOnClick(SC_NODE, "node2")
   scEnd(SC_NODE) -- We are done with node1!


scCreate(SC_OBJECT, "to_node2")
scPlace(5, 496, 244, 441, SC_FRONT)
places a hotspot at 5, 496, 244, 441, on the front image

Pipmak does it a better way.. when you run the room it generates (with a few lines of code) a flat panoramic image, you then edit the image and use a 256 pallette and draw hotspots in the colour order.. ie red, green etc. then delete the original image, then save it as a hotspot png and its loaded as an invisible overlay (i think)

if you want to see what i mean i can add the images.. or do a demo
View user's profile Send private message
  
Vincent


Joined: 25 Dec 2006
Posts: 296
Reply with quote
You can create a mobile as hotspot, define a script variable for it (assume named 'hotspot'). Then in the function OnLButtonUp of user script file, add below codes:

Code:
   local ray=GetRayFromPoint(x,y)
   if (hotspot.intersectRay(ray)) then
      LoadScene(GetAppPath()..'scenes\\'..'node2.sce')
   end


If you don’t want to see the mobile, check it's No Render style.
View user's profile Send private message
  
nigec


Joined: 04 Jul 2007
Posts: 212
Reply with quote
Cool got that Very Happy

Would it be possible to control which direction you face as you enter a room? at the moment i'll face the original shot view
Also change the cursor on rollover
View user's profile Send private message
  
Vincent


Joined: 25 Dec 2006
Posts: 296
Reply with quote
You can create a shot to locate camera, then assign shot name when call LoadScene function.
For cursor on rollover, you can hide original cursor by wnd.ShowCursor() function. Then draw a own image on cursor positon; or first create & hide a Image2D, then set it's position and show it when rollover.
View user's profile Send private message
  
nigec


Joined: 04 Jul 2007
Posts: 212
Reply with quote
Thanks Smile
I'm still toying with the cursors .. i can turn it off and back on as you leave the hotspot but not to sure how to change it to another type, its a shame it didn't
act like 2D text and bring up the hand cursor

When you did the .dds file what output size did you use? 1024 looks great but takes awhile to load, so i guess it was 512? I used cubmapgen by ATI
I guess if i could do a fade out as it changes nodes it might look better
this is the project so far.. theres 3 nodes heading to the house, node one is the dds you did.. the others use 1024
I http://www.nigecstudios.co.uk/games/CubicRoom.rar


really think this is going to work tho
View user's profile Send private message
  
Vincent


Joined: 25 Dec 2006
Posts: 296
Reply with quote
Currently, you cann't change cursor type in Awakening. But it's not difficult to custom own cursor:

Code:
local mx, my;
local bDrawCursor=false;

function OnMouseMove(x,y)
   mx=x;
   my=y;

   local ray=GetRayFromPoint(x,y)
   if (hotspot.intersectRay(ray)) then
      wnd.ShowCursor(false)
      bDrawCursor=true
   else
      wnd.ShowCursor(true)
      bDrawCursor=false
   end

end

function Render2D(draw)
   if (bDrawCursor) then
      draw.fillcircle(point.new(mx,my),8,8)
   end
end



512 is a suitable size for cube map, 1024 is too big for some old 3-D accelerators.

About fade out effect, you can use a overlay to cover 3d scene, then dynamically change it's transparence, see the Hall demo.

The package you did is a good start (but the node2.sce need reinstall).
View user's profile Send private message
  
nigec


Joined: 04 Jul 2007
Posts: 212
Reply with quote
Quote:
(but the node2.sce need reinstall).

yes i know.. now i've got a basic grasp of things I'm going to rebuild it and add a splash screen, menu and get some direction control
Also re render the images at 512
thanks for all your help

edit i just tried the above code and all that happens is the cursor diappears Confused
I take i replace the OnMouseMove function in the user file and it should draw a circle as the cursor is over the hotspot??
View user's profile Send private message
  
Vincent


Joined: 25 Dec 2006
Posts: 296
Reply with quote
Yes, it should draw a circle. You can check error message in the console to debug codes.
View user's profile Send private message
  
nigec


Joined: 04 Jul 2007
Posts: 212
Reply with quote
strange it doesn't show an error

I wonder if its a Vista issue.. i've had stuff not showing before, i'll try it on our XP computer

I'm going to look at some other engines to see how they get extra cursors, i need to be able add an inventory item as a cursor so you can use it on something..
View user's profile Send private message
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic