Visualization
About built-in and 3rd party, classic and real-time rendering solutions, settings, workflows, etc.

Set Texture Origin for GDL Objects?

derekjackson
Expert
Hi,
I've made a GDL object which essentially performs as a wall tile, each one 500mm square.

I've placed them in a grid covering my wall 4 objects wide by 4 high (so a 2m square piece of wall).

I want to apply a tiling texture that I've made that is 1m square to the group of objects, so the texture will be display twice horizontally and twice vertically.

The problem is, each object seems to have its own texture origin so the texture placement just goes crazy, and using the Set Origin command has no effect when I try to use it to unify the objects' texture placement.

Is there a way round this? Is it not possible to set a Texture Origin for an object?
http://www.lsiarchitects.co.uk
http://derekjackson.artstation.com
AC19 / 21 / 23 / 27
Windows 7 Intel Xeon 18Gb
7 REPLIES 7
Anonymous
Not applicable
I believe what you are looking for is the COOR function. You can look it up in the GDL reference. As I recall it's a bit tricky but give it a try and then come back if you have questions.
Karl Ottenstein
Moderator
David Nicholson-Cole's GDL Cookbook 4, which never made it to press, give a good example of setting the texture origin for elements within an object.

The book is copyrighted by DNC, but is apparently available for download from various sites... I just found this one which has working links:
http://www.btsquarepeg.com/2008/03/11/download-gdl-cookbook-4-pdf/

I've compressed the images on the pages of interest so that they are small enough to upload here for you. Note the VERT and COOR commands in the second column of the second page, which align the wood grain on the chair pieces properly.

Cheers,
Karl
One of the forum moderators
AC 28 USA and earlier   •   macOS Sequoia 15.2, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
vfrontiers
Advocate
Ok... I know I'm not stupid, but this is FRYING MY BRAIN... I have such a simple goal...
1. Put an IMAGE on a PLANE
a. The image will stretch to the extents of the plane
b. The image will START at the lower left corner

2. I NEED to use a MATERIALs TEXTURE to do this because the PICTURE command does NOT translate to ENSCAPE...

3. I need to ROTATE the object (automatically) to point AT THE CAMERA
a. I can already do this part, but the texture wants to start at 0,0... so it is shifted on the plane by half.

I've gone thru COOR / VERT / TEVE... but cannot get it to shift over -a/2...

Any help appreciated..


DUane
Duane

Visual Frontiers

AC25 :|: AC26 :|: AC27
:|: Enscape3.4:|:TwinMotion

DellXPS 4.7ghz i7:|: 8gb GPU 1070ti / Alienware M18 Laptop
David Collins
Advocate
Here's a tutorial I posted back in 2009. Maybe this helps?
*****

One thing that's counter-intuitive here is that the VERT/COOR statements must be placed after the object code.

Also remember to place a BODY -1 statement before the object code as a companion to the one at the end of the VERT/COOR statements. This makes sure that the new texture origin applies apply only to the specific object. Of course, several objects can be included between the the BODY -1 statements. A stray BODY -1 anywhere in between the object code and the VERT/COOR statements will cancel the texture change.

Another thing: Apply the origin changes to the VERT/COOR statements, along with the required DEL statements, instead of trying to work out the vert vectors.

Here's what works for me:


MATERIAL brick

BODY -1

PRISM_ 5, 0.10,
0,0,15,
0,1,15,
1,1,15,
1,0,15,
0,0,-1

ROTy 90
ADD 0.30, 1.20, 0.00
base
vert 0, 0, 0
vert 1, 0, 0
vert 0, 1, 0
vert 0, 0, 1
coor 2 + 256, -1, -2, -3, -4
DEL 2

BODY -1
David Collins

Win10 64bit Intel i7 6700 3.40 Ghz, 32 Gb RAM, GeForce RTX 3070
AC 27.0 (4001 INT FULL)
vfrontiers
Advocate
Thanks a bunch... I was trying to do the modifications in the VERT commands unsuccessfully. This is a much simpler way..

Note that I also put a switch in the parameters to MIRROR the texture (to make the variety of the plants look better)… I was unable to use an EQUATION in the "x" vector, but was able to set up a simple IF THEN and have the x direction turn from positive to negative.

Anyway, your suggestion was very much appreciated.


duane
Duane

Visual Frontiers

AC25 :|: AC26 :|: AC27
:|: Enscape3.4:|:TwinMotion

DellXPS 4.7ghz i7:|: 8gb GPU 1070ti / Alienware M18 Laptop
Anonymous
Not applicable
David wrote:
Here's a tutorial I posted back in 2009. Maybe this helps?
*****

One thing that's counter-intuitive here is that the VERT/COOR statements must be placed after the object code.

Also remember to place a BODY -1 statement before the object code as a companion to the one at the end of the VERT/COOR statements. This makes sure that the new texture origin applies apply only to the specific object. Of course, several objects can be included between the the BODY -1 statements. A stray BODY -1 anywhere in between the object code and the VERT/COOR statements will cancel the texture change.

Another thing: Apply the origin changes to the VERT/COOR statements, along with the required DEL statements, instead of trying to work out the vert vectors.

Here's what works for me:


MATERIAL brick

BODY -1

PRISM_ 5, 0.10,
0,0,15,
0,1,15,
1,1,15,
1,0,15,
0,0,-1

ROTy 90
ADD 0.30, 1.20, 0.00
base
vert 0, 0, 0
vert 1, 0, 0
vert 0, 1, 0
vert 0, 0, 1
coor 2 + 256, -1, -2, -3, -4
DEL 2

BODY -1
Worked a charm for me! Spent ages trying and in the end it was the -1,-2,-3,-4 at end of COOR.
Can someone explain why that works the way it does?
Lingwisyer
Guru
GDL wrote:
Use a minus sign (-) before VERT indices if they are used only for defining the local coordinate system.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660