Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Texture coordinates

#1
Hi,

I wrote a little tool [1] to make a terrain from brushes from an image. It is quite limited in usefulness, but I wondered for while about a central shortcoming: I couldn't figure out how to set texture coordinates correctly such the texture seams match.

[1] https://github.com/fps/map0

Is there a way to get the textures aligned correctly if considered as projected from the top? Patches welcome..

NOTE: Don't try this with images much larger than 100x100 pixels Wink
formerly known as lda17h
Reply

#2
Usually, as a mapper, one solve this by using texture projection at shader level.

heres an example from data/xonotic-maps.pk3dir/scripts/terrain01x.shader
Code:
textures/terrain01x/blends-mars-rock01-ground01-projected
{
    qer_editorimage textures/terrain01x/blends/mars-rock01-ground01.tga
    
    q3map_bounceScale  0.5
    dpoffsetmapping - 2 match8 229

    q3map_lightmapSampleOffset 8
    q3map_nonplanar
    q3map_shadeangle 95

    surfaceparm dust

    q3map_alphaMod dotproduct2 ( 0 0 0.95 )
    q3map_tcGen ivector ( 1024 0 0 ) ( 0 1024 0 )

    {
        map textures/terrain01x/rock/mars01.tga    // Primary
    }

    {
        map textures/terrain01x/ground/mars01.tga    // Secondary
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA        
        alphaGen vertex
    }

    {
        map $lightmap
        blendFunc GL_DST_COLOR GL_ZERO
    }
}

the magic line here is
Code:
    q3map_tcGen ivector ( 1024 0 0 ) ( 0 1024 0 )
on which you can find more infi here
Reply

#3
Thanks for your reply tZork. Using a shader to do the texture projection is a nice way around this problem I suppose. I must admit though that I was kind of lazy in my first post about this subject and while I described the consequence of my problem OK I should really have asked about the source.

The source of my problem really was that I didn't quite understand the texture coordinate mapping in .map files, especially in the brushDef format.

Interestingly enough that shader line you mention

Code:
    q3map_tcGen ivector ( 1024 0 0 ) ( 0 1024 0 )

looks suspiciously again like the interesting parts of the brushDefs.

From searching the web I found out that it's the two rows of a homogenous transform which is applied to the vertices after being transformed into a different basis. That transformation into a different basis is the missing part that is not well documented sadly. Can you maybe shed light on that issue, too?

I will also experiment with the shader you mentioned Smile

Thanks again,
homs
formerly known as lda17h
Reply

#4
unfortunately i only know how to use the .shaders, not how the code behind them works. if you manage to catch div0 on irc he may be able to give you some pointers.. thats abt the only option i can think of Tongue
Reply

#5
(05-13-2015, 12:58 PM)tZork Wrote: unfortunately i only know how to use the .shaders, not how the code behind them works. if you manage to catch div0 on irc he may be able to give you some pointers.. thats abt the only option i can think of Tongue

Thanks for the replies anyways. Your input is highly appreciated Smile
formerly known as lda17h
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  Texture release thread _para 10 904 10-29-2018, 03:56 PM
Last Post: BuddyFriendGuy
  Tech texture set by Cr4zy now officially distributed under GPLv2+ license illwieckz 3 430 10-05-2018, 09:39 AM
Last Post: Julius
  Texture and Player Model Creation Help Molnija 5 458 09-30-2018, 12:04 PM
Last Post: Molnija
  [SOLVED] 3d texture? Z(Rus) 2 1,710 01-23-2016, 06:30 AM
Last Post: Z(Rus)
  Anyone needs an already-existing texture upscaled? acerspyro 0 1,680 07-16-2015, 02:44 PM
Last Post: acerspyro
  List of Procedural Texture Generation Programs AllegedlyDead 11 78,970 03-05-2015, 10:43 AM
Last Post: DNK72
  Cleax - a clean and futuristic texture set Maddin 7 11,131 10-18-2013, 11:18 AM
Last Post: Maddin
  Shader Issues With Q3A Texture Replacement Packs Orbiter Sunblast 2 3,120 09-06-2013, 03:51 PM
Last Post: Orbiter Sunblast
  qer_normalImage texture: sets the normal map for bump mapping kristus 2 3,681 07-20-2013, 12:50 PM
Last Post: kristus
  Tutorial (basics) - Howto edit a playerskin/texture. paperclips 0 2,351 03-23-2013, 12:46 PM
Last Post: paperclips

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-