![]() |
||
|
| |||
Comprendre et mettre en pratique le multitexturing en VRML grâce aux extensions de mutitexturage de BScontact et Blaxxun (pas d'utilisation des shaders). Les différents exemples utilisent deux textures pour être compatible avec le maximun de cartes graphiques 3D. Le didacticiel fait référence à des logiciels spécifiques, mais les fonctions utilisées sont présentes dans de nombreux autres outils du même genre. ( Blender?, lightwave ,maya ,Gimp , paintshoppro, Med Editor, vrmlpad...). Understand and practice the multitexturing in VRML with the mutitexturing extensions of BScontact and Blaxxun (not use shaders). The various examples use only two textures to be compatible with the maximun of 3D graphics board. The tutorial refers to specific application softwares, but functions used are present in many other tools of the same kind (Blender?, lightwave, Maya, Gimp, paintshoppro, Med Editor, vrmlpad...).
VRML
VRML+BScontact extension
3-1) Objectif du didacticiel / Tutorial objective : Comprendre et mettre en pratique le multitexturing en VRML sous BS6, en utilisant le "detail mapping" pour le texturage d'un terrain. Understand and practice the multitexturing in VRML under BS6, by using the detail mapping for the ground texturing. 3-2) Connaissances requises / Necessary knowledge :
3-3) Detail mapping : Dans le cas d'un terrain, une seule texture ne permet pas en général d'avoir une qualitée de texturage suffisante : a) Soit la texture est trop petite, auquel cas la répétition est visible, surtout de loin, même si la texture est bien faite et sans jointures (seamless). b) Ou bien une grosse texture qui recouvre tout le terrain ce qui donne une bonne qualitée de loin mais pas pour un utilisateur qui marcherait sur le terrain. La solution est donc d'utiliser le multitexturing pour conjuguer les deux solutions, en superposant les deux textures grâce à l'extension VRML de BS6, en donnant à chacunes une taille différente. In case of ground, only one texture does not permit to obtain in general an adequate quality of texturing : a) If the texture is too small, the repetition is perceptible, especially in the far, even if texture is well done and seamless. b) Or a large texture which cover up all the ground, the quality is good in the far, but not for an user who would walk on the ground. The solution is to use the multitexturing to combine the two solutions, by superimposing two textures with the VRML BS6 extension and in giving eachother a different size. 3-4) Description : 3-4a) Création du terrain / Ground creation Pour cet exemple j'ai crée un terrain dans un logiciel de landscape (wolrdmachine, terragen, vistapro.....). J'ai récupéré à partir de cet utilitaire une map de relief, une map de lightmap. (utilisation de worldmachine, j'ai directement capturé l'écran pour récupérer les maps découpées alors avec photoshop) for this exemple, I create a ground in a landscape software (wolrdmachine, terragen, vistapro.....). I made with this utility a relief map, a lightmap (using worldmachine, I directly captured the screen to recover the maps, cut out then with photoshop) http://www.world-machine.com/
Le relief du terrain / Relief of the ground lightmap 3-4b) Création du maillage / Mesh creation Passons au maillage du terrain. J'importe le relief du terrain dans mon logiciel de 3d habituel où je réalise un DISPLACEMENT pour créer le terrain à partir de la map de relief. (je préfére créer le maillage directement dans mon éditeur 3d plutot que de l'exporter à partir du logiciel de landscape) After that, I import the ground relief in my usual 3D software, where I apply a DISPLACEMENT on the mesh for create the ground from the relief map. (I prefer to create directly the mesh in my 3D editor rather than to export it from the landscape software).
le maillage d'origine 100*100m / idem après
displacement
the origin ground mesh / same after displacement J'applique ensuite un mapping plat au maillage puis j'exporte en VRML. (sous 3dsmax j'utilise "l'exporteur" VRML de base, ne pas oublier avant l'export d'appliquer une texture bitmap au maillage, sans quoi les coordonnées de mapping ne seront pas présentes dans le fichier VRML) After that, I apply a plane mapping to the mesh and I export in VRML. (Under 3dsmax I use the basic VRML exporter. Don't forget before the export to apply a bitmap texture to the mesh, without that mapping coordinates will be not in the VRML file).
mapping plat sur le terrain / flat mapping on the ground 3-4d) Texture de pigment / Pigment texture Avec un logiciel bitmap utilisant les calques, je réalise alors la texture de pigment en mixant la texture lightmap et une image contenant la couleur. C'est la texture de base à appliquer au maillage, j'ai choisi une taille de 256*256 pour cette texture car le terrain est petit : Texture pigment 256*256 Terrain maillage 100m*100m 2.56 pixel/metre VRML 1<=>1 metre With a bitmap software using layers, I realize the pigment texture in mixing lightmap texture and a colored picture. This is the texture to apply to the mesh. I choose the size 256*256 for this texture because the ground is small. pigment texture 256*256 mesh texture 100m*100m 2.56 pixel/meter VRML 1<=>1 meter
+
Lightmap image contenant du "bruit" et la couleur / a picture with noise and colors
Texture pigment qui sera utilisée sur le maillage pigment texture will be use on the mesh 3-4e) Texture detail je l'ai trouvé sur noctua-graphics où il y a plein de textures seamless libres, J'ai modifié la couleur et le contraste. Elle est de grande taille, c'est important pour une texture de détail. I found it on noctua-graphics where there are many free seamless textures. I modify the color and the contrast. She has a big size, it is important for a details texture .
Texture détail qui sera utilisée sur le maillage Detail texture who will be used on the mesh 3-4f) Modification du source VRML
/ VRML source modification
Editer le fichier source à "la main" est rébarbatif, mais cela permet de controler à 100% le résultat. Nous avons donc le fichier VRML, la texture de pigment, la texture de détail. Il reste à modifier notre fichier source en VRML pour y ajouter le multitexturing. Grâce à un éditeur de texte, nous allons remplacer le node "texture" par un "MultiTexture " : Edit manually the source file is unpleasing, but it is possible to control by 100% the result. We have the VRML file, the pigment texture and the detail texture. It remains to modify our VRML source to add the multitexturing. With a texte editor, we will replace the "texture" node by a "multitexture" : #nodes à remplacer / nodes to replaceAjoutons ensuite en entête la définitions en externproto des extensions au VRML de BScontact 6 que nous utilisons: Next let us add in heading the externproto definitions of BScontact extensions which we use : Pour finir ajoutons divers éléments pour finir la scène, la lumiére n'éclaire pas le terrain dont la texture pigment.jpg contient déjà les informations de l'éclairage : To close let us add various elements to finish the scene, the light does not lighting the ground whose texture pigment.jpg contains already information of lighting : PointLight {
4-1) Objectif du didacticiel / Tutorial objective : Comprendre et mettre en pratique le multitexturing en VRML sous BS6, en utilisant 2 textures sur un maillage avec un mapping pour chaque textures. Understand and practice the multitexturing in VRML under BS6, by using 2 textures on a mesh with one mapping for each textures. 4-2) Connaissances requises / Necessary knowledge :
4-3) Deux Mapping différents / two differents mapping ? Comme dans les logiciels 3D, en VRML grâce aux extensions de BS6 il est possible d'appliquer un mapping différent pour les différentes textures d'un objet. Dans l'exemple qui suit, une sorte de réservoir, je vais appliquer deux textures : - de l'acier rouillé pour la matière de base. - une texture comprenant trois logos qui seront appliqués sur le maillage indépendament de leurs positions dans la texture. As in the 3D software, in VRML with the BS6 extensions it is possible to apply a different mapping for various textures of an object. In the example which follows, a kind of tank, I will apply two textures : - rusted steel for the first texture. - a texture including three logos which will be applied to the mesh independently of their positions in texture.
iron02.jpg logos.jpg 4-4) Description : 4-4a) Le modèle / model Pour la modélisation du réservoir, j'utilise l'outil EXTRUSION sur la coupe du réservoir (12m de diamètre) : For modeling the tank, I use the tool EXTRUSION on the 2d cut of the tank (12m of diameter).
coupe 2D / cut 2d extrusion (j'utilise souvent le modeleur AMAPI
qui est trés intuitif, il existe des versions gratuites,
j'ai récupéré la mienne dans une revue ! j'exporte ensuite en *.3DS, www.amapi.net www.eovia.com). I recovered mine in a review ! then I export in * 3DS, www.amapi.net www.eovia.com). 4-4b) Texture/mapping n°1 Pour la première texture (provient de noctua-graphics) représentant l'acier , un mapping en cylindre conviendra à la forme du réservoir. For the first texture (comes from noctua-graphics) representing steel, a cylinder mapping will be appropriate for the shape of the tank.
Exportons cette premiére version de l'objet en VRML dans un fichier temporaire:source1.wrl Let us export this first version of the VRML object in a temporary file: source1.wrl 4-4c) Texture/mapping n°2 Réalisons maintenant le mapping de la deuxième texture. Nous allons mapper les triangles du maillage sur la texture "logo.jpg". Les éditeurs 3D permettant le mapping ont généralement un outils pour cette fonction : - Pour COSMOWORLD, c'est le PEP texture applicator. (Aprés l'avoir uitilisé, il vaut mieux faire un import/export du fichier VRML avec 3DSmax, cela permet d'avoir un tableau "texCoordIndex" trié) - Sous 3DSmax, il y a le modificateur "unwrapUVW". Let us make the mapping of the second texture.We are going to map the triangles of the mesh on texture "logo.jpg". The 3d editors allowing the mapping, have generally tools for this function : - For COSMOWORLD, this is the PEP texture applicator. (After using it , it is better to do an import/export of VRML file with 3DSmax, this operation create a sorted table "texCoordIndex" ) - Under 3DSmax, there is the modifier "unwrapUVW".
Exportons cette deuxiéme version de l'objet en VRML dans un fichier temporaire : source2.wrl Export this second version of the vrml object in a temporary file : source2.wrl 4-4d) Modification du source VRML / VRML source modification On a donc deux fichiers vrml ( source1.wrl source2.wrl ) contenant le même maillage avec un texturage/mapping différent. Utilisons un éditeur de texte pour créer un troisième fichier contenant le maillage avec les deux textures/mapping : We have now two vrml files (source1.wrl source2.wrl) including the same mesh with a different texture/mapping : Let us to use a text editor to create a third file including the mesh with both texture/mapping : Copy to clipboard to ZOOM
source1.wrl + source2.wrl = final.wrl
! ATTENTION, les valeurs du tableau "texCoordIndex" des deux fichiers sources doivent être identiques (l'exporteur de base de 3DSmax fait cela trés bien, 4-4c ). ! BE CAREFUL, values of table "texCoordIndex" of two source files must be identicals. ( the 3DSmax export make that very well, 4-4c). 4-4e) Placement Reste à placer maintenant l'objet dans la scéne, j'utilise pour cela les protos de M. peter gerstmann, la rotation puis la translation (VisibleTransformsPackage: visual object manipulators). Remain to place now the object in the scene, for that I use protos of Mr. Peter gerstmann, the rotation then the translation (VisibleTransformsPackage: visual object manipulators). http://accad.osu.edu/~pgerstma/
5-1) Objectif du didacticiel / Tutorial objective : Utiliser les extensions au VRML de BS6 pour réaliser un effet de chrome sur des surfaces arrondies simulant des flaques et une surface plane pour le contenu du réservoir du didacticiel précédent. To use the VRML extensions of BS6 to make a chrome effect on round surfaces simulating puddles and a plane surface for the top of the tank of the preceding tutorial. 5-2) Connaissances requises / Necessary knowledge :
5-3) Chrome : L'effet de chrome est rendu par BS6 qui calcule en temps réel les coordonnées de texture du maillage suivant la projection de type "SPHERE" : TextureCoordGen {mode "SPHERE"} Suivant la texture, le type de projection, on peut donner différents effets... Pour cet exemple je vais appliquer deux textures aux modèles, la texture de chrome dont le mapping sera dynamique, une texture orange avec un mapping plan : The chrome effect is render by BS6 which calculates in realtime the texture coordinates of the mesh with a "SPHERE" projection : TextureCoordGen {mode "SPHERE"} According to texture, the projection type, we can put differents effects... For this example I will apply two textures on the models, the chrome map with dynamic mapping, an orange texture with a plane mapping :
reflet.jpg orange.jpg 5-4b) Mapping du modèle n°1 / mapping of the model n°1 Appliquons un mapping plat, qui servira pour la texture fixe. Sur l'image le mapping est grand car j'utilise le même que celui du terrain . Let us apply a flat mapping for the fixed texture. On the picture the mapping is large because I use the same one of the ground .
Exportons l'objet en VRML. Export the object in VRML. 5-4c) Modification du source VRML / VRML source modification Ajoutons le multitexturing & les mapping pour les quatres flaques de liquide orange. Dans le MultiTextureCoordinate on ajoute le mapping "SPHERE" pour la texture reflet.jpg. Let us add the multitexturing & the mapping for the four puddles of orange liquid. In the MultiTextureCoordinate add the mapping "SPHERE" for the texture reflet.jpg. Copy to clipboard to ZOOM
source modif ! ATTENTION, l'effet dépend de la valeur de lissage : CREASEANGLE 3.14 ! BE CAREFUL, the effect depends on the value of smoothing : CREASEANGLE 3.14 5-4d) Modèle n°2 / model n°2 Pour la surface du réservoir il faut suivre la même procédure. Mais pour le mapping il faut utiliser "CAMERASPACEREFLECTIONVECTOR". For the top of the tank you must follow the same procedure. But for the mapping it is necessary to use "CAMERASPACEREFLECTIONVECTOR".
6-1) Objectif du didacticiel / Tutorial objective : Réaliser l'éclairage d'une scéne rapidement grâce à LMM (light map maker) dont l'exportation en VRML utilise les extensions au VRML de BS 6 pour afficher deux textures: pigment + lightmap Quickly make the lighting of a scene with LMM (light map maker) wich export in VRML with the BS6 VRML extensions for rendering two textures : pigment + lightmap 6-2) Connaissances requises / Necessary knowledge :
6-3) Lightmap : Le principe des lighmap est simple, il s'agit de mélanger une texture de pigment avec une texture contenant l'éclairage (voir les sites relatifs aux lightmaps de Quake), la seconde ayant une faible résolution. The principle of the lighmap is simple, mixing a texture of pigment with a texture including lighting (see the sites about Quake lightmaps) ,the second having a low resolution . Copy to clipboard to ZOOM
lightmap texture final Pour cet exemple je vais éclairer un modèle utilisant une texture. J'utilise LMM pour l'éclairage car il est simple, on importe le fichier *.3ds, on ajuste les paramètres de la scène (éclairage, texture, précision des surfaces) puis on exporte en *.wrl.. Malgrés le numéro de version : 0.3 de LMM , il est trés interressant, de plus le prix de la license est de 38$ ! & l'excellent support technique est trés rapide. For this example I'm lighting a model using one texture. I'm using LMM for lighting because it is simple, first import *.3ds file, next adjust parameters of the scene (lighting, texture, surfaces precisions ). LMM is in beta 0.3, but it is interesting, and the license price is 38$ ! & the excellent technical support is very fast. www.windssoft.com
lightmap 256*256 pigment 512*512 6-4b) Mapping Appliquons un mapping en forme de cube pour tous les élements de la scène, qui servira pour la texture de pigment. Sur l'image le mapping est grand car j'utilise le même que celui du terrain. Let us apply a box mapping on all the scene elements, it will be use for pigment texture. On the picture the mapping is large because I use the same one of the ground .
Exportons l'objet en *.3DS pour l'utiliser dans LMM. Avec LMM quand j'utilise plusieurs textures, j'exporte un fichier *.3DS par texture car LMM en import *.3DS ne sépare pas les objets. Export the object in * 3DS to use it in LMM. With LMM when i'm using several textures, i export one *.3ds file per texture, because in import LMM don't separate objects. 6-4c) Importation du modèle dans Light Map Maker / Import the model in LMM - Importons maintenant la scène en *.3ds dans LMM "File->Import" , sélectionner "Surface". - Import now the *.3ds scene in LMM "File->Import" , select "Surface".
la résolution des lightmaps est inversement proportionnelle à cette valeur. -After select all surfaces on the screen, set the "Patch size" to 0.5, the resolution of the lightmaps is inversely proportional to this value.
couleur orange au centre des piliers en hauteurs:
in the center of the pillars in height.
- We can now render the lightmap : "Edit->Calculate Light Maps" or F9
- Exportez en VRML "File->Export",
en choisissant l'option "Texture X lightmap".
- Export in VRML "File->Export",
choose "Texture X lightmap"option. Vous pouvez voir dans la scène,
une sphère animée, elle est mappée avec deux textures
dont les paramètres TextureTransform.scale et TextureTransform.translation sont animés via un javascript. You can see in the scene, the animated sphere, she is mapped with two textures of which parameters TextureTransform.scale and TextureTransform.translation are animated with a javascript. 8) Référence / Reference www.web3d.org spécifications du X3D sur le multitexturing (18.2.4 Multitexturing ). X3D specifications the multitexturing (18.2.4 Multitexturing ). BScontact Blaxxun www.web3d-fr.com 9) Contact A l'heure du X3D, des shaders de BScontact 6.2 et plusieurs années aprés l'apparition du multitexturing avec blaxxun Contact 5.0, le multitexturing sur internet est rare... J'espère que ce didacticiel sera utile pour ceux désirant s'initier au multitexturing en VRML. At the hour of the X3D, the shaders of BScontact 6.2 and several years after the blaxxun Contact 5.0, the multitexturing on Internet is rare... I hope that this tutorial will be useful for those wishing to initiate themself with the VRML multitexturing. RAMI Hachmi rhvrml@free.fr (c) 2004 RAMI Hachmi for www.web3d-fr.com. Make with Netscape 7 Composer. Test with Netscape 7, Opera 7... |
|
18 internaute(s) sur Web3d-fr
|
Copyright Web3d-fr 2001-2004
|
| Création de mondes VRML/X3D | |
| Autres technos Web3d | |
| Outils et logiciels | |
| 3D multi-utilisateurs | |
| Articles et informations | |
| Ressources gratuites | |
| Autres sites et portails 3D | |
| Trouver un emploi | |
|
| |