IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

OpenGL Discussion :

Parseur fichier OBJ & MTL


Sujet :

OpenGL

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Par défaut Parseur fichier OBJ & MTL
    Bonjour,

    Je viens enfin de finaliser mon viewer de model 3D en OpenGL ES, mais là en testant un cas bien précis, je suis tombé sur un os...
    Dans mon logiciel pour modéliser, j'ai dessiné une forme quelconque, et sur quelques triangles, j'ai appliqué une texture. Cette texture, j'ai choisi de la placer correctement, et du coup j'ai dû bouger l'offset, et le tiling.
    Du coup, dans mon fichier matériel, j'ai ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    newmtl 03_-_Default
    Ka  0.6 0.6 0.6
    Kd  0.6 0.6 0.6
    Ks  0.9 0.9 0.9
    d  1.0
    Ns  0.0
    illum 2
    map_Kd -o -0.1 -0.3 0.0 -s -3.4 3.2 1.0 map1.png
    Dans tous les autres parseurs de MTL, je n'en ai pas trouvé qui intègre cette information.
    D'après une rapide analyse, je dirais que :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    -o u v w
     
    The -o option offsets the position of the texture map on the surface by shifting the position of the map origin. The default is 0, 0, 0.
     
    "u" is the value for the horizontal direction of the texture
     
    "v" is an optional argument.
    "v" is the value for the vertical direction of the texture.
     
    "w" is an optional argument.
    "w" is the value used for the depth of a 3D texture.
     
    -s u v w
     
    The -s option scales the size of the texture pattern on the textured surface by expanding or shrinking the pattern. The default is 1, 1, 1.
     
    "u" is the value for the horizontal direction of the texture
     
    "v" is an optional argument.
    "v" is the value for the vertical direction of the texture.
     
    "w" is an optional argument.
    "w" is a value used for the depth of a 3D texture.
    "w" is a value used for the amount of tessellation of the displacement map.
     
    -t u v w
     
    The -t option turns on turbulence for textures. Adding turbulence to a texture along a specified direction adds variance to the original image and allows a simple image to be repeated over a larger area without noticeable tiling effects.
     
    turbulence also lets you use a 2D image as if it were a solid texture, similar to 3D procedural textures like marble and granite.
     
    "u" is the value for the horizontal direction of the texture turbulence.
     
    "v" is an optional argument.
    "v" is the value for the vertical direction of the texture turbulence.
     
    "w" is an optional argument.
    "w" is a value used for the depth of the texture turbulence.
     
    By default, the turbulence for every texture map used in a material is uvw = (0,0,0). This means that no turbulence will be applied and the 2D texture will behave normally.
     
    Only when you raise the turbulence values above zero will you see the effects of turbulence.
    (d'après ici : http://www.fileformat.info/format/material/)

    Du coup, je me demandais comment intégrer ces données à mon viewer. A quel moment cela intervient pour le dessin de mes textures ? Ce sont mes coordonnées de textures qui doivent être changées ?

  2. #2
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Par défaut
    Bon j'ai résolu mon soucis (enfin un paliatif...).
    Sous mon logiciel de dessin 3D, j'ai trouvé une option pour générer les coordonnées de textures indépendamment du "tiling" et de l'offset.
    Du coup, hop ça fonctionne bien comme ça

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Irrlicht] recherche code (lire/afficher) fichier OBJ
    Par Husqvarna dans le forum Irrlicht
    Réponses: 3
    Dernier message: 14/03/2006, 11h19
  2. Cherche parseur fichier robots.txt
    Par bluecurve dans le forum Langage
    Réponses: 9
    Dernier message: 12/07/2005, 07h28
  3. fichier *.obj???
    Par neril dans le forum OpenGL
    Réponses: 2
    Dernier message: 13/04/2005, 10h07
  4. Réponses: 8
    Dernier message: 18/05/2004, 10h03
  5. Est-ce que les fichiers .obj sont tous les mêmes?
    Par Bubonik software dans le forum Langages de programmation
    Réponses: 2
    Dernier message: 30/12/2003, 21h04

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo