Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (rki), 426 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
flat model to terrain? #450602
04/19/15 10:02
04/19/15 10:02
Joined: Oct 2013
Posts: 31
JerahYalyn Offline OP
Newbie
JerahYalyn  Offline OP
Newbie

Joined: Oct 2013
Posts: 31
hi, I made couple of road models which is just a flat model with couple of vertices, like this.


How do I flat it on the terrain surface without just like it's a part of the terrain. I know I have to look for the terrain normal for this but it confuses me on how to implement it. Setting it's orientation to terrain surface is not enough since the road model with usually intersect multiple terrain surface and it will look funny if a part of the road is not connected to the surface.

And also is the a way to enable keep both normal map and detailed texture for the terrain. When set my terrain to use normal map to for terrain shadow it ignores the detail map resulting a bad terrain detail up close.

Re: flat model to terrain? [Re: JerahYalyn] #450607
04/19/15 14:27
04/19/15 14:27
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi,

To your first question: you can do a c_trace with SCAN_TEXTURE to hit the terrain and use the 'hit' (/hit.nx,ny,nz) info combined with vec_to_angle wink .

This may also help https://www.google.nl/search?q=angle+to+...eTqHMfvaI74gagH

Last edited by Reconnoiter; 04/19/15 14:29.
Re: flat model to terrain? [Re: Reconnoiter] #450633
04/19/15 19:50
04/19/15 19:50
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
This is not a trivial problem but a rather complicated one instead. I think best results (or any decent at all) would come from subdividing the road's mesh, based on the terrain's triangle grid and the road's orientation, then adapt the vertex height. You would have to dig into DirectX functions for that plan though.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: flat model to terrain? [Re: Superku] #450634
04/19/15 20:02
04/19/15 20:02

M
Malice
Unregistered
Malice
Unregistered
M



Why not simply use bmap pixel instructions to paint the road texture onto the terrain at the location? or can this not be done for some reason?

Re: flat model to terrain? [Re: ] #450641
04/19/15 21:25
04/19/15 21:25
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
This works in theory but the terrain texture would have to be huge, even on small terrains, to only have bare acceptable results let's say for an airplane simulator.
Maybe one could come up with a fancy projection shader on the terrain skin to solve the resolution issue but this won't work of course when you want to use 3d meshes for the road and its border.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: flat model to terrain? [Re: Superku] #450650
04/20/15 01:24
04/20/15 01:24
Joined: Oct 2013
Posts: 31
JerahYalyn Offline OP
Newbie
JerahYalyn  Offline OP
Newbie

Joined: Oct 2013
Posts: 31
Now it just fot more complicated. But I guess directx function is the only solution. I concept was actualy from a game I use to play called arma and road models ar actual mesh that ars set flat to the ground. Now flatting mesh to the surface will cause flickering on the surface so I have to work with z-bias aswell to make sure road is drawn on top of the terrain and not just move it one quants higher. I thought it would be an simple task.

Re: flat model to terrain? [Re: JerahYalyn] #450656
04/20/15 09:04
04/20/15 09:04
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
it would be simpler if your modeler , modeled the road on to the terrain ,for eg. in 3dstudio max ,you could create the terrain with a displace modifier ,on a plane with sections in width and height to the amount of tiles needed , then you could export and import in to MED and convert to terrain , and convert your road separately .

you could also lightmap it etc..

you can also convert both as a single model but that would miss out on real terrain performance.

coding it would be difficult ,however if I am not mistaken tust has spline roads ?


Compulsive compiler
Re: flat model to terrain? [Re: Wjbender] #450661
04/20/15 10:36
04/20/15 10:36
Joined: Oct 2013
Posts: 31
JerahYalyn Offline OP
Newbie
JerahYalyn  Offline OP
Newbie

Joined: Oct 2013
Posts: 31
That would make allot of road models if I export it individually. I have several models of the road including different curvs. One idea I have is to move the model's vertecis based on the terrain slope since I have a scaled terrain and adjust the uv. I will only call the function once per model during initialization of the level. Again it is still in my head and I have to look in to the manual for all functions that I can use.

Last edited by JerahYalyn; 04/20/15 12:18.
Re: flat model to terrain? [Re: JerahYalyn] #450664
04/20/15 11:45
04/20/15 11:45
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Oh sry I see now you meant laying the road over the terrain as like a curtain over a floor (maybe bad analogy? grin ). I thought you just meant changing the tilt/angle.

You could change the vertices. Maybe trace to get the world coordinates of the terrain points and than convert them to local coordinates (see vector calculations). I think that will work, don't know for sure cause never tried moving vertices.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1