`
kennyluo
  • 浏览: 81870 次
  • 性别: Icon_minigender_1
  • 来自: 珠海
社区版块
存档分类
最新评论

Dynamic texture coordinate generation using the TexCoordGeneration class

阅读更多

This example illustrates dynamic texture coordinate generation using the TexCoordGeneration class. The OBJECT_LINEAR, EYE_LINEAR and SPHERE_MAP modes are illustrated. The application creates a DEM landscape (from a sin/cos curve) and uses dynamic texture coordinate generation to map contours onto the landscape - either relative to its relative position (OBJECT_LINEAR) or absolute position (EYE_LINEAR). SPHERE_MAP maps the contours onto the landscape as a environment map. The "Rotate" and "Translate" buttons toggle two Interpolators that rotate and translate the entire scene respectivly.

 

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.GraphicsConfigTemplate;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.net.URL;

import javax.media.j3d.Alpha;
import javax.media.j3d.AmbientLight;
import javax.media.j3d.Appearance;
import javax.media.j3d.AudioDevice;
import javax.media.j3d.Background;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.Bounds;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.DirectionalLight;
import javax.media.j3d.GraphicsConfigTemplate3D;
import javax.media.j3d.Group;
import javax.media.j3d.Locale;
import javax.media.j3d.Material;
import javax.media.j3d.PhysicalBody;
import javax.media.j3d.PhysicalEnvironment;
import javax.media.j3d.PositionInterpolator;
import javax.media.j3d.RotationInterpolator;
import javax.media.j3d.Shape3D;
import javax.media.j3d.TexCoordGeneration;
import javax.media.j3d.Texture;
import javax.media.j3d.TextureAttributes;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.View;
import javax.media.j3d.ViewPlatform;
import javax.media.j3d.VirtualUniverse;
import javax.vecmath.Color3f;
import javax.vecmath.Point2f;
import javax.vecmath.Point3d;
import javax.vecmath.Point3f;
import javax.vecmath.Vector3d;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;

import com.sun.j3d.audioengines.javasound.JavaSoundMixer;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.GeometryInfo;
import com.sun.j3d.utils.geometry.NormalGenerator;
import com.sun.j3d.utils.image.TextureLoader;

/**
 * This example illustrates dynamic texture coordinate generation using the
 * TexCoordGeneration class. The OBJECT_LINEAR, EYE_LINEAR and SPHERE_MAP modes
 * are illustrated. The application creates a DEM landscape (from a sin/cos
 * curve) and uses dynamic texture coordinate generation to map contours onto
 * the landscape - either relative to its relative position (OBJECT_LINEAR) or
 * absolute position (EYE_LINEAR). SPHERE_MAP maps the contours onto the
 * landscape as a environment map. The "Rotate" and "Translate" buttons toggle
 * two Interpolators that rotate and translate the entire scene respectivly.
 */
public class TexCoordTest extends Java3dApplet implements ActionListener {
  private static int m_kWidth = 500;

  private static int m_kHeight = 400;

  // we need to track these as we modify them inside
  // the actionPerformed method
  Appearance m_Appearance = null;

  TexCoordGeneration m_TexGen = null;

  PositionInterpolator m_PositionInterpolator = null;

  RotationInterpolator m_RotationInterpolator = null;

  public TexCoordTest() {
    initJava3d();
  }

  protected void addCanvas3D(Canvas3D c3d) {
    setLayout(new BorderLayout());
    add(c3d, BorderLayout.CENTER);

    Panel controlPanel = new Panel();

    // creates some GUI components so we can modify the
    // scene and texure coordinate generation at runtime
    Button eyeButton = new Button("EYE_LINEAR");
    eyeButton.addActionListener(this);
    controlPanel.add(eyeButton);

    Button objectButton = new Button("OBJECT_LINEAR");
    objectButton.addActionListener(this);
    controlPanel.add(objectButton);

    Button sphereButton = new Button("SPHERE_MAP");
    sphereButton.addActionListener(this);
    controlPanel.add(sphereButton);

    Button rotateButton = new Button("Rotate");
    rotateButton.addActionListener(this);
    controlPanel.add(rotateButton);

    Button translateButton = new Button("Translate");
    translateButton.addActionListener(this);
    controlPanel.add(translateButton);

    add(controlPanel, BorderLayout.SOUTH);

    doLayout();
  }

  // overidden as we don't want a background for this example
  protected Background createBackground() {
    return null;
  }

  // we are using a big landscape so we have to scale it down
  protected double getScale() {
    return 0.05;
  }

  // handle event from the GUI components we created
  public void actionPerformed(ActionEvent event) {
    if (event.getActionCommand().equals("EYE_LINEAR") != false)
      m_TexGen.setGenMode(TexCoordGeneration.EYE_LINEAR);

    else if (event.getActionCommand().equals("OBJECT_LINEAR") != false)
      m_TexGen.setGenMode(TexCoordGeneration.OBJECT_LINEAR);

    else if (event.getActionCommand().equals("SPHERE_MAP") != false)
      m_TexGen.setGenMode(TexCoordGeneration.SPHERE_MAP);

    else if (event.getActionCommand().equals("Rotate") != false)
      m_RotationInterpolator.setEnable(!m_RotationInterpolator
          .getEnable());

    else if (event.getActionCommand().equals("Translate") != false)
      m_PositionInterpolator.setEnable(!m_PositionInterpolator
          .getEnable());

    // apply any changes to the TexCoordGeneration and copy into the
    // appearance
    TexCoordGeneration texCoordGeneration = new TexCoordGeneration();
    texCoordGeneration = (TexCoordGeneration) m_TexGen
        .cloneNodeComponent(true);
    m_Appearance.setTexCoordGeneration(texCoordGeneration);
  }

  // position the viewer in the scene
  public TransformGroup[] getViewTransformGroupArray() {
    TransformGroup[] tgArray = new TransformGroup[1];
    tgArray[0] = new TransformGroup();

    // move the camera BACK a little...
    // note that we have to invert the matrix as
    // we are moving the viewer
    Transform3D t3d = new Transform3D();

    t3d.rotX(0.4);
    t3d.setScale(getScale());
    t3d.setTranslation(new Vector3d(0.0, 0, -20.0));
    t3d.invert();
    tgArray[0].setTransform(t3d);

    return tgArray;
  }

  // we create a scene composed of two nested interpolators
  // one for translation, one for rotation that control
  // a DEM landscape created from a single Shape3D containing
  // a QuadArray.
  protected BranchGroup createSceneBranchGroup() {
    BranchGroup objRoot = super.createSceneBranchGroup();

    TransformGroup objPosition = new TransformGroup();
    objPosition.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    TransformGroup objRotate = new TransformGroup();
    objRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

    Transform3D axisTranslate = new Transform3D();
    axisTranslate.rotZ(Math.toRadians(90));

    Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0,
        6000, 0, 0, 0, 0, 0);

    m_PositionInterpolator = new PositionInterpolator(rotationAlpha,
        objPosition, axisTranslate, 0, 70);

    m_PositionInterpolator.setSchedulingBounds(createApplicationBounds());
    objPosition.addChild(m_PositionInterpolator);
    m_PositionInterpolator.setEnable(false);

    m_RotationInterpolator = new RotationInterpolator(rotationAlpha,
        objRotate, new Transform3D(), 0.0f, (float) Math.PI * 2.0f);

    m_RotationInterpolator.setSchedulingBounds(getApplicationBounds());
    objRotate.addChild(m_RotationInterpolator);
    m_RotationInterpolator.setEnable(true);

    TransformGroup tgLand = new TransformGroup();
    Transform3D t3dLand = new Transform3D();
    t3dLand.setTranslation(new Vector3d(0, -30, 0));
    tgLand.setTransform(t3dLand);

    tgLand.addChild(createDemLandscape());
    objRotate.addChild(tgLand);

    objPosition.addChild(objRotate);

    objRoot.addChild(objPosition);

    // create some lights for the scene
    Color3f lColor1 = new Color3f(0.3f, 0.3f, 0.3f);
    Vector3f lDir1 = new Vector3f(-1.0f, -1.0f, -1.0f);
    Color3f alColor = new Color3f(0.1f, 0.1f, 0.1f);

    AmbientLight aLgt = new AmbientLight(alColor);
    aLgt.setInfluencingBounds(getApplicationBounds());
    DirectionalLight lgt1 = new DirectionalLight(lColor1, lDir1);
    lgt1.setInfluencingBounds(getApplicationBounds());

    // add the lights to the parent BranchGroup
    objRoot.addChild(aLgt);
    objRoot.addChild(lgt1);

    return objRoot;
  }

  // create the Appearance for the landscape Shape3D
  // and initialize all the texture generation paramters
  // the yMaxHeight paramters is the maximum height of the
  // landscape. It defines a scale factor to convert from
  // landscape Y coordinates to texture coordinates
  // (in the range 0 to 1).
  void createAppearance(double yMaxHeight) {
    // create an Appearance and assign a Material
    m_Appearance = new Appearance();
    m_Appearance.setCapability(Appearance.ALLOW_TEXGEN_WRITE);

    Color3f black = new Color3f(0, 0.2f, 0);
    Color3f objColor = new Color3f(0.1f, 0.7f, 0.2f);
    m_Appearance.setMaterial(new Material(objColor, black, objColor, black,
        0.8f));

    // load the texture image
    TextureLoader texLoader = new TextureLoader("stripes.gif", Texture.RGB,
        this);

    // clamp the coordinates in the S dimension, that way they
    // will not wrap when the calculated texture coordinate falls outside
    // the range 0 to 1. When the texture coordinate is outside this range
    // no texture coordinate will be used
    Texture tex = texLoader.getTexture();
    tex.setBoundaryModeS(Texture.CLAMP);

    // assign the texute image to the appearance
    m_Appearance.setTexture(tex);

    // create the TexCoordGeneration object.
    // we are only using 1D texture coordinates (S) - texture coordinates
    // are calculated from a vertex's distance from the Y = 0 plane
    // the 4th parameter to the Vector4f is the distance in *texture
    // coordinates*
    // that we shift the texture coordinates by (i.e. Y = 0 corresponds to S
    // = 0.5)
    TexCoordGeneration texGen = new TexCoordGeneration(
        TexCoordGeneration.OBJECT_LINEAR,
        TexCoordGeneration.TEXTURE_COORDINATE_2, new Vector4f(0,
            (float) (1.0 / (2 * yMaxHeight)), 0, 0.5f),
        new Vector4f(0, 0, 0, 0), new Vector4f(0, 0, 0, 0));

    // create our "non-live" TexCoordGeneration object so we
    // can update the "genMode" parameter after we go live.
    m_TexGen = (TexCoordGeneration) texGen.cloneNodeComponent(true);

    // assign the TexCoordGeneration to the Appearance
    m_Appearance.setTexCoordGeneration(texGen);

    // we just glue the texture image to the surface, we are not
    // blending or modulating the texture image based on material
    // attributes. You can experiment with MODULATE or BLEND.
    TextureAttributes texAttribs = new TextureAttributes();
    texAttribs.setTextureMode(TextureAttributes.DECAL);
    m_Appearance.setTextureAttributes(texAttribs);
  }

  // create the Shape3D and geometry for the DEM landscape
  BranchGroup createDemLandscape() {
    final double LAND_WIDTH = 200;
    final double LAND_LENGTH = 200;
    final double nTileSize = 10;
    final double yMaxHeight = LAND_WIDTH / 8;

    // calculate how many vertices we need to store all the "tiles" that
    // compose the QuadArray.
    final int nNumTiles = (int) (((LAND_LENGTH / nTileSize) * 2) * ((LAND_WIDTH / nTileSize) * 2));
    final int nVertexCount = 4 * nNumTiles;
    Point3f[] coordArray = new Point3f[nVertexCount];
    Point2f[] texCoordArray = new Point2f[nVertexCount];

    // create the Appearance for the landscape and initialize all
    // the texture coordinate generation parameters
    createAppearance(yMaxHeight);

    // create the parent BranchGroup
    BranchGroup bg = new BranchGroup();

    // create the geometry and populate a QuadArray
    // we use a simple sin/cos function to create an undulating surface
    // in the X/Z dimensions. Y dimension is the distance "above sea-level".
    int nItem = 0;
    double yValue0 = 0;
    double yValue1 = 0;
    double yValue2 = 0;
    double yValue3 = 0;

    final double xFactor = LAND_WIDTH / 5;
    final double zFactor = LAND_LENGTH / 3;

    // loop over all the tiles in the environment
    for (double x = -LAND_WIDTH; x <= LAND_WIDTH; x += nTileSize) {
      for (double z = -LAND_LENGTH; z <= LAND_LENGTH; z += nTileSize) {
        // if we are not on the last row or column create a "tile"
        // and add to the QuadArray. Use CCW winding
        if (z < LAND_LENGTH && x < LAND_WIDTH) {
          yValue0 = yMaxHeight * Math.sin(x / xFactor)
              * Math.cos(z / zFactor);
          yValue1 = yMaxHeight * Math.sin(x / xFactor)
              * Math.cos((z + nTileSize) / zFactor);
          yValue2 = yMaxHeight * Math.sin((x + nTileSize) / xFactor)
              * Math.cos((z + nTileSize) / zFactor);
          yValue3 = yMaxHeight * Math.sin((x + nTileSize) / xFactor)
              * Math.cos(z / zFactor);

          // note, we do not assign any texture coordinates!
          coordArray[nItem++] = new Point3f((float) x,
              (float) yValue0, (float) z);
          coordArray[nItem++] = new Point3f((float) x,
              (float) yValue1, (float) (z + nTileSize));
          coordArray[nItem++] = new Point3f((float) (x + nTileSize),
              (float) yValue2, (float) (z + nTileSize));
          coordArray[nItem++] = new Point3f((float) (x + nTileSize),
              (float) yValue3, (float) z);
        }
      }
    }

    // create a GeometryInfo and assign the coordinates
    GeometryInfo gi = new GeometryInfo(GeometryInfo.QUAD_ARRAY);
    gi.setCoordinates(coordArray);

    // generate Normal vectors for the QuadArray that was populated.
    NormalGenerator normalGenerator = new NormalGenerator();
    normalGenerator.generateNormals(gi);

    // wrap the GeometryArray in a Shape3D
    Shape3D shape = new Shape3D(gi.getGeometryArray(), m_Appearance);

    // add the Shape3D to a BranchGroup and return
    bg.addChild(shape);

    return bg;
  }

  public static void main(String[] args) {
    TexCoordTest texCoordTest = new TexCoordTest();
    texCoordTest.saveCommandLineArguments(args);

    new MainFrame(texCoordTest, m_kWidth, m_kHeight);
  }
}

/*******************************************************************************
 * Copyright (C) 2001 Daniel Selman
 * 
 * First distributed with the book "Java 3D Programming" by Daniel Selman and
 * published by Manning Publications. http://manning.com/selman
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, version 2.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * The license can be found on the WWW at: http://www.fsf.org/copyleft/gpl.html
 * 
 * Or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite
 * 330, Boston, MA 02111-1307, USA.
 * 
 * Authors can be contacted at: Daniel Selman:  daniel@selman.orgThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it 
 * 
 * If you make changes you think others would like, please contact one of the
 * authors or someone at the www.j3d.org web site.
 ******************************************************************************/

//*****************************************************************************
/**
 * Java3dApplet
 * 
 * Base class for defining a Java 3D applet. Contains some useful methods for
 * defining views and scenegraphs etc.
 * 
 * @author Daniel Selman
 * @version 1.0
 */
//*****************************************************************************

abstract class Java3dApplet extends Applet {
  public static int m_kWidth = 300;

  public static int m_kHeight = 300;

  protected String[] m_szCommandLineArray = null;

  protected VirtualUniverse m_Universe = null;

  protected BranchGroup m_SceneBranchGroup = null;

  protected Bounds m_ApplicationBounds = null;

  //  protected com.tornadolabs.j3dtree.Java3dTree m_Java3dTree = null;

  public Java3dApplet() {
  }

  public boolean isApplet() {
    try {
      System.getProperty("user.dir");
      System.out.println("Running as Application.");
      return false;
    } catch (Exception e) {
    }

    System.out.println("Running as Applet.");
    return true;
  }

  public URL getWorkingDirectory() throws java.net.MalformedURLException {
    URL url = null;

    try {
      File file = new File(System.getProperty("user.dir"));
      System.out.println("Running as Application:");
      System.out.println("   " + file.toURL());
      return file.toURL();
    } catch (Exception e) {
    }

    System.out.println("Running as Applet:");
    System.out.println("   " + getCodeBase());

    return getCodeBase();
  }

  public VirtualUniverse getVirtualUniverse() {
    return m_Universe;
  }

  //public com.tornadolabs.j3dtree.Java3dTree getJ3dTree() {
  //return m_Java3dTree;
  //  }

  public Locale getFirstLocale() {
    java.util.Enumeration e = m_Universe.getAllLocales();

    if (e.hasMoreElements() != false)
      return (Locale) e.nextElement();

    return null;
  }

  protected Bounds getApplicationBounds() {
    if (m_ApplicationBounds == null)
      m_ApplicationBounds = createApplicationBounds();

    return m_ApplicationBounds;
  }

  protected Bounds createApplicationBounds() {
    m_ApplicationBounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0),
        100.0);
    return m_ApplicationBounds;
  }

  protected Background createBackground() {
    Background back = new Background(new Color3f(0.9f, 0.9f, 0.9f));
    back.setApplicationBounds(createApplicationBounds());
    return back;
  }

  public void initJava3d() {
    //  m_Java3dTree = new com.tornadolabs.j3dtree.Java3dTree();
    m_Universe = createVirtualUniverse();

    Locale locale = createLocale(m_Universe);

    BranchGroup sceneBranchGroup = createSceneBranchGroup();

    ViewPlatform vp = createViewPlatform();
    BranchGroup viewBranchGroup = createViewBranchGroup(
        getViewTransformGroupArray(), vp);

    createView(vp);

    Background background = createBackground();

    if (background != null)
      sceneBranchGroup.addChild(background);

    //    m_Java3dTree.recursiveApplyCapability(sceneBranchGroup);
    //  m_Java3dTree.recursiveApplyCapability(viewBranchGroup);

    locale.addBranchGraph(sceneBranchGroup);
    addViewBranchGroup(locale, viewBranchGroup);

    onDoneInit();
  }

  protected void onDoneInit() {
    //  m_Java3dTree.updateNodes(m_Universe);
  }

  protected double getScale() {
    return 1.0;
  }

  public TransformGroup[] getViewTransformGroupArray() {
    TransformGroup[] tgArray = new TransformGroup[1];
    tgArray[0] = new TransformGroup();

    // move the camera BACK a little...
    // note that we have to invert the matrix as
    // we are moving the viewer
    Transform3D t3d = new Transform3D();
    t3d.setScale(getScale());
    t3d.setTranslation(new Vector3d(0.0, 0.0, -20.0));
    t3d.invert();
    tgArray[0].setTransform(t3d);

    return tgArray;
  }

  protected void addViewBranchGroup(Locale locale, BranchGroup bg) {
    locale.addBranchGraph(bg);
  }

  protected Locale createLocale(VirtualUniverse u) {
    return new Locale(u);
  }

  protected BranchGroup createSceneBranchGroup() {
    m_SceneBranchGroup = new BranchGroup();
    return m_SceneBranchGroup;
  }

  protected View createView(ViewPlatform vp) {
    View view = new View();

    PhysicalBody pb = createPhysicalBody();
    PhysicalEnvironment pe = createPhysicalEnvironment();

    AudioDevice audioDevice = createAudioDevice(pe);

    if (audioDevice != null) {
      pe.setAudioDevice(audioDevice);
      audioDevice.initialize();
    }

    view.setPhysicalEnvironment(pe);
    view.setPhysicalBody(pb);

    if (vp != null)
      view.attachViewPlatform(vp);

    view.setBackClipDistance(getBackClipDistance());
    view.setFrontClipDistance(getFrontClipDistance());

    Canvas3D c3d = createCanvas3D();
    view.addCanvas3D(c3d);
    addCanvas3D(c3d);

    return view;
  }

  protected PhysicalBody createPhysicalBody() {
    return new PhysicalBody();
  }

  protected AudioDevice createAudioDevice(PhysicalEnvironment pe) {
    JavaSoundMixer javaSoundMixer = new JavaSoundMixer(pe);

    if (javaSoundMixer == null)  System.out.println("create of audiodevice failed");

    return javaSoundMixer;
  }

  protected PhysicalEnvironment createPhysicalEnvironment() {
    return new PhysicalEnvironment();
  }

  protected float getViewPlatformActivationRadius() {
    return 100;
  }

  protected ViewPlatform createViewPlatform() {
    ViewPlatform vp = new ViewPlatform();
    vp.setViewAttachPolicy(View.RELATIVE_TO_FIELD_OF_VIEW);
    vp.setActivationRadius(getViewPlatformActivationRadius());

    return vp;
  }

  protected Canvas3D createCanvas3D() {
    GraphicsConfigTemplate3D gc3D = new GraphicsConfigTemplate3D();
    gc3D.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
    GraphicsDevice gd[] = GraphicsEnvironment.getLocalGraphicsEnvironment()
        .getScreenDevices();

    Canvas3D c3d = new Canvas3D(gd[0].getBestConfiguration(gc3D));
    c3d.setSize(getCanvas3dWidth(c3d), getCanvas3dHeight(c3d));

    return c3d;
  }

  protected int getCanvas3dWidth(Canvas3D c3d) {
    return m_kWidth;
  }

  protected int getCanvas3dHeight(Canvas3D c3d) {
    return m_kHeight;
  }

  protected double getBackClipDistance() {
    return 100.0;
  }

  protected double getFrontClipDistance() {
    return 1.0;
  }

  protected BranchGroup createViewBranchGroup(TransformGroup[] tgArray,
      ViewPlatform vp) {
    BranchGroup vpBranchGroup = new BranchGroup();

    if (tgArray != null && tgArray.length > 0) {
      Group parentGroup = vpBranchGroup;
      TransformGroup curTg = null;

      for (int n = 0; n < tgArray.length; n++) {
        curTg = tgArray[n];
        parentGroup.addChild(curTg);
        parentGroup = curTg;
      }

      tgArray[tgArray.length - 1].addChild(vp);
    } else
      vpBranchGroup.addChild(vp);

    return vpBranchGroup;
  }

  protected void addCanvas3D(Canvas3D c3d) {
    setLayout(new BorderLayout());
    add(c3d, BorderLayout.CENTER);
    doLayout();
  }

  protected VirtualUniverse createVirtualUniverse() {
    return new VirtualUniverse();
  }

  protected void saveCommandLineArguments(String[] szArgs) {
    m_szCommandLineArray = szArgs;
  }

  protected String[] getCommandLineArguments() {
    return m_szCommandLineArray;
  }
} 

 

分享到:
评论

相关推荐

    动态纹理人脸活体检测

    动态纹理人脸活体检测技术是基于对人脸动态纹理特征的提取和分析来判断一个人脸图像是否为真实的人脸,而不是由伪造品、照片或视频等产生的假脸。这种方法能够帮助保护生物识别系统免受欺骗攻击(spoofing attack)...

    Texture-Generation.rar_C Builder_in_texture generation

    在C++ Builder中进行纹理生成是一项重要的图形编程任务,它涉及到计算机图形学和游戏开发等领域。纹理生成是指在二维或三维模型表面应用图像的过程,这些图像可以增强视觉效果,增加真实感,使得虚拟世界更加生动。...

    Rotation invariant texture classification using LBP variance (LBPV)

    distribution, we first estimate the principal orientations of the texture image and then use them to align LBP histograms. The aligned histograms are then in turn used to measure the dissimilarity ...

    Local Binary Patterns

    1. Guoying Zhao, Matti Pietikäinen, "Dynamic Texture Recognition Using Local Binary Patterns with an Application to Facial Expressions," IEEE Transactions on Pattern Analysis and Machine ...

    Color Texture Classification Using Wavelet Transform

    Color Texture Classification Using Wavelet Transform

    Unity动态字体文字破碎的解决方法(Dynamic Font Broken)

    因此,在使用 Dynamic Font 时,需要请求足够多的文字信息,以避免 texture 不够的情况。 解决方法是,准备足够多的汉字文本,然后在请求文字信息后,内部 texture 就会被扩展到足够大的大小,从而避免了文字破碎的...

    Texture-Synthesis-Using-Convolutional-Neural-Networks-master.zip

    在“Texture Synthesis Using Convolutional Neural Networks”这个项目中,我们探讨了如何利用深度学习,特别是卷积神经网络(CNN),来实现这一目标。CNN在图像处理领域表现出色,特别是在图像分类、对象检测和...

    threex.dynamictexture:处理动态生成纹理的three.js助手

    Threex.dynamictexture 是一个。 它提供了一种处理动态生成纹理的简单方法。 灵感来自优秀的 ,它获得了 。 它主要用于在纹理中写入文本。 假设你有一个角色会说些什么,你可能想把它放在一个纹理中并在你的角色上方...

    Unity插件:Easy Movie Texture (Video Texture) v3.24

    [ And it uses a dynamic link, there is no obligation to disclose the source. ] [Source code is included in the package. If necessary, it may be used to modify. ] Supported resolutions: Android: ...

    Easy Movie Texture

    [ And it uses a dynamic link, there is no obligation to disclose the source. ] [Source code is included in the package. If necessary, it may be used to modify. ] Download link is below. EasyMovie...

    Seamless Image-Based Texture Atlases using Multi-band Blending.pdf

    本文提出了一种新颖的方法,用于从三维模型和一组校准图像中创建高质量的纹理贴图。该方法主要关注避免由于光度和几何不精确性而产生的视觉缺陷,例如颜色不连续性、鬼影或模糊。首先,我们计算了网格面片的划分,...

    Simulating planar reflection using two-pass rendering and texture mapping

    Simulating planar reflection using two-pass rendering and texture mapping 1. There ‘s a table with flat rectangular semi-reflective table-top in the 3D scene 2. On/Around the table are some 3D ...

    Texture Relative Superpixel Generation With Adaptive Parameters

    Texture Relative Superpixel Generation With Adaptive Parameters

    fire的渲染,模拟

    The ProceduralFire sample creates a fire effect by rendering a ... parameters to the pixel shader through texture coordinate interpolators and to vary perturbation maps scrolling speed and offset.

    fast texture synthesis on arbitrary meshs

    While texture synthesis on surfaces has received much attention in computer graphics, the ideal solution that quickly produces high-quality textures with little user intervention has remained elusive....

    Mari真实皮肤纹理绘制视频教程Painting a Realistic Skin Texture using Mari

    Mari是一款强大的3D纹理绘画软件,由The Foundry公司开发,它提供了广阔的画布和无限制的图层系统,使得艺术家能够自由地进行细节创作。在教程中,讲师会引导你熟悉这些基本功能,包括笔刷设置、颜色选择、图层混合...

    CUDA cpp class texture demo

    在这个"CUDA cpp class texture demo"中,我们将探讨如何在CUDA C++程序中利用纹理内存(Texture Memory)进行高效的计算。 纹理内存是CUDA中一种优化的存储类型,特别设计用于高效地处理图形和图像数据。与全局...

    glm,基于openGL的obj文件处理程序

    glm.h Nate Robins, 1997, 2000 ... Wavefront OBJ model file format reader/writer/manipulator. Includes routines for generating smooth ... coordinate generation (spheremap and planar projections) + more.

    Easy Movie Texture Video Texture3.5.4

    最新的Easy Movie Texture Video Texture3.5.4,支持PC端,VR开发,由于原包70M,而我只能上传60M资源,所以删除了一个视频资源,如果demo无法播放请设置播放其他视频资源。

    Physically Based Rendering from Theory to Implementation - part1

    Texture Coordinate Generation 2D (u, v) Mapping Spherical Mapping Cylindrical Mapping Planar Mapping 3DMapping Texture Interface and Basic Textures Constant Texture Scale Texture Mix Textures...

Global site tag (gtag.js) - Google Analytics