Texturing to match object size

Questions and answers about the how and why of making maps.
Post Reply
User avatar
Zehra
Private First Class
Private First Class
Posts: 914
Joined: Sun Oct 18, 2015 3:36 pm
Location: Within the BZFS API and Beyond it
Contact:

Texturing to match object size

Post by Zehra »

Hi all

I'm currently working on some texturing for an object, but I've noticed the texture pattern repeats or stretches oddly.
I currently would like it to use the texture and have it be the size of the object.
So the size of the texture does not matter, just the way it renders it.

Like if I create a box being 2x2, the texture is increased/decreased in size to be 2x2.(So it does not repeat.)
The textures do not appeared to be centered most of the time as well.
If someone could shed some light on how to center the textures and have them scale to the objects size, it would be much appreciated.
(Examples would be highly appreciated too.)

-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Re: Texturing to match object size

Post by JeffM »

Define the object as a mesh not a box (and no, not a mesh box a real mesh) and define your own UV coordinates. All automatic texture mapping’s will repeat.
ImageJeffM
User avatar
Zehra
Private First Class
Private First Class
Posts: 914
Joined: Sun Oct 18, 2015 3:36 pm
Location: Within the BZFS API and Beyond it
Contact:

Re: Texturing to match object size

Post by Zehra »

Creating meshes requires use of a 3D editor, and I haven't been able to successfully use one.
(Blender and Wings3D are pretty confusing.)

-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Re: Texturing to match object size

Post by JeffM »

That is the easiest way, but you can code them by hand too.

But you have to uses a mesh to get what you want. That what meshes are for, tota control over geometry and texture placement.
ImageJeffM
User avatar
Zehra
Private First Class
Private First Class
Posts: 914
Joined: Sun Oct 18, 2015 3:36 pm
Location: Within the BZFS API and Beyond it
Contact:

Re: Texturing to match object size

Post by Zehra »

Creating a mesh with a 3D editor or writing it by hand is not a solution for me.
(I'd be making some really nice mesh maps, if I could do meshes.)
I also don't want textures repeating, just them to match the size of the object by scaling up or down.(Increasing or decreasing in size.)

I was sort of hoping for a very simple way of having it scale or adjust to the size of the object.
Mostly the idea was to have some textured meshboxes and not have repeating textures.
(The texture increases/decreases in size to match the meshbox.)

-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Re: Texturing to match object size

Post by JeffM »

What you are hoping for does not exist. The feature to support what you want is implemented in bzflag as meshes....
There is no "Secret" other way. I know, I developed some of the code.

Meshes are how people do billboards. They aren't that hard, just go learn a little.
ImageJeffM
User avatar
Zehra
Private First Class
Private First Class
Posts: 914
Joined: Sun Oct 18, 2015 3:36 pm
Location: Within the BZFS API and Beyond it
Contact:

Re: Texturing to match object size

Post by Zehra »

If there only was a good, simple to use mesh editor...
JeffM wrote: Thu Jun 25, 2009 5:04 pm The blender tools are probably the most complete "2.0" editing solution, but blender does have a bit of a learning curve. It is not too hard for modelers to make maps, but it seems to be rather difficult for mappers to learn how to model. There is a level of detail and knowledge that is required to use blender that most mappers have never had to worry about before.
Edit: Sadly, I'm not a modeler learning to make maps.

-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Re: Texturing to match object size

Post by JeffM »

Dude, making a cube is trivial, just TRY a little.

Code: Select all


material
	name cube
	texture bzflag-256x256
end

mesh

  vertex -0.500000 -0.500000 1.000000
  vertex 0.500000 -0.500000 1.000000
  vertex -0.500000 0.500000 1.000000
  vertex 0.500000 0.500000 1.000000
  vertex -0.500000 0.500000 0.000000
  vertex 0.500000 0.500000 0.000000
  vertex -0.500000 -0.500000 0.000000
  vertex 0.500000 -0.500000 0.000000
  
  normal 0.000000 0.000000 1.000000
  normal 0.000000 1.000000 0.000000
  normal 0.000000 0.000000 -1.000000
  normal 0.000000 -1.000000 0.000000
  normal 1.000000 0.000000 0.000000
  normal -1.000000 0.000000 0.000000
  
  texcoord 0.000000 0.000000
  texcoord 1.000000 0.000000
  texcoord 0.000000 1.000000
  texcoord 1.000000 1.000000
  
  face
    vertices 0 1 2
    normals 0 0 0
    texcoords 0 1 2
    matref cube
  endface
  face
    vertices 2 1 3
    normals 0 0 0
    texcoords 2 1 3
    matref cube
  endface
  face
    vertices 2 3 4
    normals 1 1 1
    texcoords 0 1 2
    matref cube
  endface
  face
    vertices 4 3 5
    normals 1 1 1
    texcoords 2 1 3
    matref cube
  endface
  face
    vertices 4 5 6
    normals 2 2 2
    texcoords 3 2 1
    matref cube
  endface
  face
    vertices 6 5 7
    normals 2 2 2
    texcoords 1 2 0
    matref cube
  endface
  face
    vertices 6 7 0
    normals 3 3 3
    texcoords 0 1 2
    matref cube
  endface
  face
    vertices 0 7 1
    normals 3 3 3
    texcoords 2 1 3
    matref cube
  endface
  face
    vertices 1 7 3
    normals 4 4 4
    texcoords 0 1 2
    matref cube
  endface
  face
    vertices 3 7 5
    normals 4 4 4
    texcoords 2 1 3
    matref cube
  endface
  face
    vertices 6 0 4
    normals 5 5 5
    texcoords 0 1 2
    matref cube
  endface
  face
    vertices 4 0 2
    normals 5 5 5
    texcoords 2 1 3
    matref cube
  endface
end
ImageJeffM
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: Texturing to match object size

Post by blast »

Tried adding "texsize 1 1" to your box object?
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
Zehra
Private First Class
Private First Class
Posts: 914
Joined: Sun Oct 18, 2015 3:36 pm
Location: Within the BZFS API and Beyond it
Contact:

Re: Texturing to match object size

Post by Zehra »

Thank you very much blast, it works now.

-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Re: Texturing to match object size

Post by JeffM »

Yeah, I was totally wrong, sorry about that. There is an object class called meshedbox that I missed. it's not in the map format but triggered when a legacy paremetric object is given material properties.

this works like you expect

Code: Select all


material
	name cube
	texture bzflag-256x256
end

box
	postion 0,0,0
	size 1,1,1
	rotation 0
	matref cube
	texsize 1 1
end

ImageJeffM
User avatar
Zehra
Private First Class
Private First Class
Posts: 914
Joined: Sun Oct 18, 2015 3:36 pm
Location: Within the BZFS API and Beyond it
Contact:

Re: Texturing to match object size

Post by Zehra »

No problem Jeff.
I guess my search into meshboxes left me overlooking boxes, which had the solution I was looking for. :doh:

-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
User avatar
optic delusion
Special Forces
Special Forces
Posts: 1052
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Re: Texturing to match object size

Post by optic delusion »

You can also do this with a "fixedscale" texture matrix.
If you do that, you should know that by default, textures repeat every 8 units.

Code that Trepan had prepared but never made it into official source had this material option.
texautoscale 8 8 # world view generated texcoord scales
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
User avatar
Zehra
Private First Class
Private First Class
Posts: 914
Joined: Sun Oct 18, 2015 3:36 pm
Location: Within the BZFS API and Beyond it
Contact:

Re: Texturing to match object size

Post by Zehra »

@Optic Delusion

I tried "fixscale", but it seems it isn't working.

Code: Select all

options
 -set _worldSize 100
end

textureMatrix
  name example_texmat
  fixedscale 0.0 0.0
end

material
 name example_material
 texture std_ground
 texmat example_texmat
end

meshbox
 position 0 0 0
 size 2 2 4
 matref example_material
end
I've tried a few other options, but can't seem to get the textures to do what this does.

Code: Select all

options
 -set _worldSize 100
end

material
name test
texture std_ground
end

box
  position 0 0 0
  rotation 0
  size 2 2 4
  texsize 1 1
  matref test
end
-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
User avatar
optic delusion
Special Forces
Special Forces
Posts: 1052
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Re: Texturing to match object size

Post by optic delusion »

fixedscale 0 0 doesn't look right to me, try fixedscale 2 2

but i guess you've already found your solution with texsize
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.
User avatar
Zehra
Private First Class
Private First Class
Posts: 914
Joined: Sun Oct 18, 2015 3:36 pm
Location: Within the BZFS API and Beyond it
Contact:

Re: Texturing to match object size

Post by Zehra »

Thanks Optic, it seems to work fine with fixedscale 2 2.

-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
Post Reply