Jump to content
  • entries
    941
  • comments
    5,894
  • views
    867,777

Creating a VR Teleporter


Josh

2,848 views

 Share

I'm building the VR project template for Leadwerks 4.5.  Although you can enable VR in any project, this template is specifically designed to provide some of your most common room-scale VR features:

  • Teleportation movement, which prevents motion sickness.
  • Picking up and throwing objects. (It's actually really fun!)

To start with I am creating the art assets for the teleport effect. This is basically what I want:

thelab.jpg

Your controller shoots a beam which ends in an indicator when it hits an upwards-facing slope. Typically this beam will be somewhat arced.  Why the curve? This allows you to climb up to areas above you:

Image1.jpg.df8356f46b3a9d9ed37bdfd895c76609.jpg

As always, I am starting with the game assets. I don't believe in using programmer art because it hurts your understanding of what you are trying to create, it's uninspiring, and you will end up writing your code twice once you get the final artwork and realize all the mistakes you made.

I started with textures. I know I want a circular indicator on the floor, a misty spinning effect rising off it, and a beam. I'm going to make all my textures grayscale so that I can control the color with the entity color value and dynamically change it in the game.  Here are my textures I created in about ten minutes in Paint Shop Pro:

teleport1.png.9a150b10a9b3c7533b9bd369724b92e7.png

teleport2.png.81a0eb54d0b873ea4275a5be147d3b48.png

teleport3.png.986ee249c09e764c238ef13acbfdc4ae.png

The first texture above is clamped along the X and Y axes and the second one is clamp along the Y axis.  I am using uncompressed textures for all of these because they have a lot of soft gradients.

I created my materials with the following settings, again leaving everything white:

Image2.jpg.2551ded38dcd838eeb1bc14c810161a1.jpg

In 3ds Max I created my indicator model. It's just a plane with a cylinder on top, with the end caps removed:

Image1.thumb.jpg.1643781cb380cad1292c02cc79cfa670.jpg

When I import it into Leadwerks and apply my materials, the model looks like this:

Image2.jpg.b133743a98fe0641e36f6882f12bdb65.jpg

I'll show you why I am using uncompressed textures. You can see in this shot the edge of the ring has some ugly artifacts when texture compression is used:

Image3.jpg.c9bd686cd3a547308fd878be23ae7525.jpg

Here's a closeup. Not something I want to see in VR:

Image4.png.7dd080b001152328f83a071142c26251.png

Now I am going to create an instance of the model in the editor and adjust the color. I want a bright blue glowy color. I am setting the color to RGB 128,255,255 and cranking the intensity way up to 2.0. This effectively sets the entity color to 256,512,512. This color is multiplied by the texture color at each pixel and then clamped to 0-255 (the maximum color range of the monitor). That means that the brightest spots on the material will reach a full 255,255,255 white color and look really intense, while darker parts will be tinted blue:

screenshot203.thumb.jpg.cc0c884f3c71e087456bec5a04f31115.jpg

Notice the object isn't just a flat color, but has a range of color from blue to white. To get this effect I had to increase the intensity over 1.0 to create colors brighter than RGB 255,255,255, and I had to have some red in the color. If I had set the color to RGB 0,255,255 the red channel would never increase and I would have a flat color like this. Not so good:

screenshot197.thumb.jpg.f173a701b955bc7e8fe2c78080eae449.jpg

If I had set the color to RGB 128,255,255 but left the intensity at 1.0 I would also have a solid color:

screenshot198.thumb.jpg.b760ebdb1c0804cf50fb325fdfb361f0.jpg

Finally I added a script to the model and saved it as a prefab. The script just rotates the model around slowly on its Y axis, which I think will look pretty good. I'm going to perform the rotation in the Draw() function so it doesn't get called if the object is hidden or offscreen, and I don't think anyone will notice if the rotation doesn't update when they look away:

function Script:Draw()
	self.entity:Turn(0, 0.1 * Time:GetSpeed(), 0)
end

That's it for now. The next step will be to create my teleportation mechanic in VR.

  • Like 2
 Share

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...