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: 376
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

Texturing to match object size

Post by Zehra » Thu Mar 22, 2018 2:59 am

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
There's this game I love and it's called Ducati. ~Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
The details and the skill of knowing and applying them is what excellence is made of. ~Zehra
The best player is the one who knows what to do and when and applies it successfully. ~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
My blog is available at zehrahblog.wordpress.com.
See when I've last been active at Strayers.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5149
Joined: Fri Dec 13, 2002 4:11 am
Location: [Redacted]
Contact:

Re: Texturing to match object size

Post by JeffM » Thu Mar 22, 2018 3:12 am

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.

User avatar
Zehra
Private First Class
Private First Class
Posts: 376
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

Re: Texturing to match object size

Post by Zehra » Thu Mar 22, 2018 3:16 am

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
There's this game I love and it's called Ducati. ~Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
The details and the skill of knowing and applying them is what excellence is made of. ~Zehra
The best player is the one who knows what to do and when and applies it successfully. ~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
My blog is available at zehrahblog.wordpress.com.
See when I've last been active at Strayers.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5149
Joined: Fri Dec 13, 2002 4:11 am
Location: [Redacted]
Contact:

Re: Texturing to match object size

Post by JeffM » Thu Mar 22, 2018 3:56 am

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.

User avatar
Zehra
Private First Class
Private First Class
Posts: 376
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

Re: Texturing to match object size

Post by Zehra » Thu Mar 22, 2018 4:17 pm

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
There's this game I love and it's called Ducati. ~Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
The details and the skill of knowing and applying them is what excellence is made of. ~Zehra
The best player is the one who knows what to do and when and applies it successfully. ~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
My blog is available at zehrahblog.wordpress.com.
See when I've last been active at Strayers.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5149
Joined: Fri Dec 13, 2002 4:11 am
Location: [Redacted]
Contact:

Re: Texturing to match object size

Post by JeffM » Thu Mar 22, 2018 4:48 pm

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.

User avatar
Zehra
Private First Class
Private First Class
Posts: 376
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

Re: Texturing to match object size

Post by Zehra » Thu Mar 22, 2018 4:53 pm

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
There's this game I love and it's called Ducati. ~Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
The details and the skill of knowing and applying them is what excellence is made of. ~Zehra
The best player is the one who knows what to do and when and applies it successfully. ~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
My blog is available at zehrahblog.wordpress.com.
See when I've last been active at Strayers.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5149
Joined: Fri Dec 13, 2002 4:11 am
Location: [Redacted]
Contact:

Re: Texturing to match object size

Post by JeffM » Thu Mar 22, 2018 5:11 pm

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

User avatar
blast
General
General
Posts: 4647
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: Texturing to match object size

Post by blast » Thu Mar 22, 2018 5:26 pm

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: 376
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

Re: Texturing to match object size

Post by Zehra » Thu Mar 22, 2018 5:42 pm

Thank you very much blast, it works now.

-Zehra
There's this game I love and it's called Ducati. ~Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
The details and the skill of knowing and applying them is what excellence is made of. ~Zehra
The best player is the one who knows what to do and when and applies it successfully. ~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
My blog is available at zehrahblog.wordpress.com.
See when I've last been active at Strayers.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5149
Joined: Fri Dec 13, 2002 4:11 am
Location: [Redacted]
Contact:

Re: Texturing to match object size

Post by JeffM » Thu Mar 22, 2018 6:04 pm

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


User avatar
Zehra
Private First Class
Private First Class
Posts: 376
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

Re: Texturing to match object size

Post by Zehra » Thu Mar 22, 2018 6:30 pm

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

-Zehra
There's this game I love and it's called Ducati. ~Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
The details and the skill of knowing and applying them is what excellence is made of. ~Zehra
The best player is the one who knows what to do and when and applies it successfully. ~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
My blog is available at zehrahblog.wordpress.com.
See when I've last been active at Strayers.

User avatar
optic delusion
Special Forces
Special Forces
Posts: 962
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Re: Texturing to match object size

Post by optic delusion » Sun Mar 25, 2018 2:10 am

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: 376
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

Re: Texturing to match object size

Post by Zehra » Mon Mar 26, 2018 11:18 pm

@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
There's this game I love and it's called Ducati. ~Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
The details and the skill of knowing and applying them is what excellence is made of. ~Zehra
The best player is the one who knows what to do and when and applies it successfully. ~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
My blog is available at zehrahblog.wordpress.com.
See when I've last been active at Strayers.

User avatar
optic delusion
Special Forces
Special Forces
Posts: 962
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Re: Texturing to match object size

Post by optic delusion » Mon Mar 26, 2018 11:23 pm

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: 376
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

Re: Texturing to match object size

Post by Zehra » Tue Mar 27, 2018 1:30 am

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

-Zehra
There's this game I love and it's called Ducati. ~Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
There's always something to remember and it's been a game I love. ~Zehra
The time spent is a time which can never be regained, so it's a time to enjoy. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
The details and the skill of knowing and applying them is what excellence is made of. ~Zehra
The best player is the one who knows what to do and when and applies it successfully. ~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
My blog is available at zehrahblog.wordpress.com.
See when I've last been active at Strayers.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests