WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Old 09-15-2004, 11:32 AM
vadrian vadrian is offline
Join Date: Sep 2004
Posts: 32
Question generate an infinite terrain

I am trying to make a simple flight sim world, but this question applies to any "outdoors" VE.

How can I generate an "infinitely" expanding terrain?

I want the user to fly/move about the world and always have terrain in the distance. I don't care if the pattern repeats (i.e. tile a terrain) or if its unique (i.e. dynamic/random generation).

- adrian
Reply With Quote
Old 09-15-2004, 11:44 AM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849

I've attached a sample script that simulates an infinite terrain. The basic idea is to modify the texture coordinates on a tiled texture to make it look like the ground is moving. Let me know if something isn't clear.
import viz

SIZE = 1000.0

#Create a ground on the fly
ground = viz.add('tut_ground.wrl')

def ontimer(num):
	#Keep the ground at the same xz position as the head
	pos = viz.get(viz.HEAD_POS)
	center = [ (pos[0] % SIZE) / SIZE, (pos[2] % SIZE) / SIZE ]

	#Translate and scale texture coordinates
	texmat = viz.Transform()


Reply With Quote
Old 09-15-2004, 11:58 AM
vadrian vadrian is offline
Join Date: Sep 2004
Posts: 32

and if I want to add a 3d dimension to the terrain (like hills or scattered objects), how can I do that?

It looks likes this code will only move the map over a varied terrain without actually moving the terrain. Do you think i could get the effect I want by moving a bump map in the same way?
Reply With Quote
Old 09-15-2004, 12:13 PM
mspusch mspusch is offline
WorldViz Team Member
Join Date: Feb 2003
Posts: 218
A good example for placing rendomly scattered objects in a large terrain can be found under the Vizard demo section:

Download the Vision Science Demos and have a look at the drive-sim demo.

Hope this helps, have fun!

Reply With Quote
Old 09-15-2004, 01:09 PM
tobin tobin is offline
WorldViz Team Member
Join Date: Feb 2003
Posts: 251
The basic idea for these approaches is to first create a "cyclical" world with at least 2 full cycles in each dimension. This can be either in terms of texture or geometry. For example, to create an infinite forest of geometric trees, first create a patch of trees that's roughly square and random looking. Then tile that pattern so that there are at least two copies in the X and Z direction. Then, at any point in time you can transate the user's eyepoint by exactly the width of the patch in either X or Z and there will be no apparent change in the scene. The only thing visible might be trees that are beyond the tile pattern visible in the next. You can alleviate this by either using fog to limit visibility or build a 3x3 or 4x4 tiling (instead of 2x2) and always keeping the user near the middle.
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 02:19 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC