Pages

Se afișează postările cu eticheta python. Afișați toate postările
Se afișează postările cu eticheta python. Afișați toate postările

joi, 3 octombrie 2024

Pydroid 3 android application for python ...

The Pydroid3 android application is the best way to test and run python scripts.
I install python packages with the install option, the pip command on terminal comes with errors for same python package.
I used the free version but if you pay for monthly or lifetime then you can have more features.
Same team come with android applications to have add more features, see these IIEC team appplicatons.

miercuri, 26 iunie 2024

PyCafe online tool for python.

One example on pycafe online tool with this demo with networkx python module using three.js.

joi, 11 ianuarie 2024

News : Example with kaolin on NVIDIA.

NVIDIA Kaolin library provides a PyTorch API for working with a variety of 3D representations and includes a growing collection of GPU-optimized operations such as modular differentiable rendering, fast conversions between representations, data loading, 3D checkpoints, differentiable camera API, differentiable lighting with spherical harmonics and spherical gaussians, powerful quadtree acceleration structure called Structured Point Clouds, interactive 3D visualizer for jupyter notebooks, convenient batched mesh container and more ... from GitHub repo - kaolin.
See this example from NVIDIA:
NVIDIA Kaolin library has introduced the SurfaceMesh class to make it easier to track attributes such as faces, vertices, normals, face_normals, and others associated with surface meshes.

marți, 3 ianuarie 2023

Manim : some example with manim.

You can see an official document writen in Jupiter notebook with Manim package from manim community, see this link.

duminică, 9 ianuarie 2022

News : JAM Winter 2022 for development.

Here's a new opportunity for developers who know or want to develop games named Winter 2022 and is a JAM.
In this case JAM the official website tells us "A game jam is an event where participants try to make a video game as quickly as possible." or "Just a minute (JAM)".
Looks like there are no severe restrictions on this JAM.
I also wrote on my blog about the well-known python pygame package.
You can find more about this JAM on the official webpage.

luni, 15 iulie 2019

Krita 4.2.2 : Programming with python.

The Krita application is written in C++ using an application framework called Qt5.
You can use python to create scripts for Krita software.
You can use Tools - Script - Scripter from the main menu to write your python script.
I don't use often this python module, but today I created this script.
The script creates a new document with size 512x512 named Python test document.
After that create a duplicate of the layer named Background.
The new layer is named the new Layer duplicate.
from krita import *
from  krita import Krita

print(dir(krita))
print(help(Krita))

d = Krita.instance().createDocument(512, 512, "Python test document", "RGBA", "U8", "", 120.0)
Krita.instance().activeWindow().addView(d)

print(dir(d))
print(Krita.instance().filters())

node_name = 'Background'
node = d.nodeByName(node_name)
print(node.name())
print(dir(node))

d_n = node.duplicate()
print(dir(d_n))

d_n.setName("new Layer duplicate")
print(d_n.name())
root_node = d.rootNode()
print(help(root_node.addChildNode))
root_node.addChildNode(d_n, node)

duminică, 15 iulie 2018

Microsoft Azure Batch and Blender 3D addon .

You can use Azure Microsoft account to render your Blender 3D files.
First you need a Azure account. Download the Blender addon for azure from here.
Unzip the addon and copy the content of Blender.Client into addon folder.
I try to use the install option from Blender 3D - User Preferences but not working.
You need to use pip3 tool with python from Blender 3D.
Download the pip3 tool from here into python Blender 3D folder and run this commands:
C:\Program Files\Blender Foundation\Blender\2.79\python\bin>python.exe get-pip.py
...
Successfully installed pip-10.0.1 setuptools-40.0.0 wheel-0.31.1

C:\Program Files\Blender Foundation\Blender\2.79\python\bin>cd ..
C:\Program Files\Blender Foundation\Blender\2.79\python>cd Scripts
C:\Program Files\Blender Foundation\Blender\2.79\python\Scripts>
pip3.exe install credentials
pip3.exe install azure-batch-apps
This will install the python modules for the Blender addon for Azure Microsoft.

Login with your Azure account and create your batch service:


I try to use a free account with $200 credit but the Azure Microsoft come with this note:
You cannot  use your Azure monetary commitment funds or subscription credits ...

miercuri, 4 aprilie 2018

About Blender 3D and python API versus learners.

The last version of Blender 3D API come with many features and option to solve your issues.
Too many for a normal user.
For example: if you want to add some images into SEQUENCE_EDITOR this will help you.
From starting you need to know the last API and this may not be the last option.
The BlendDataImages(bpy_struct) - version 2.79 and can be used.
Another option is this function on the version 2.78 the scene.sequence_editor.sequences.new_image.
The good way is to have a good area of examples and tutorials into documentation.
This will solve many post on Blender 3D community area.

What I want to say is the desire of the developers to manifest themselves and not to maintain the user learning process.
Most API learners do not have the same speed of processing and learning as developers, especially if there are multiple and frequent changes.

sâmbătă, 10 martie 2018

The Ren'Py visual novel engine .

Today I tested the Ren'Py visual novel engine.
The development team tell us:
  Ren'Py is a visual novel engine – used by thousands of creators from around the world – that helps you use words, images, and sounds to tell interactive stories that run on computers and mobile devices. These can be both visual novels and life simulation games. The easy to learn script language allows anyone to efficiently write large visual novels, while its Python scripting is enough for complex simulation games. Ren'Py is open source and free for commercial use.
For android development and emulation you need to install Java SE Development Kit.
The base of engine is a application named renpy.
This allow us to update , build and make emulation ( phone, tablet and television) for your game.
You can test all of this by starting one default game.
I don't make a tutorial about how to create a new game, just how to deal with this engine.
You can create a new game by using: + Create New Project.
This will create a new project to start you 2D game novel with your questions and answers , GUI and images.
This can be see on the next screenshot work with this engine:

marți, 12 septembrie 2017

The Lithosphere Terrain Generator.



This is a 3D software for terrain generator named lithosphere.
Is simple to use it because use nodes.
You to create and export material textures and heightmaps intended for use in realtime graphics applications.

Features

  • Realtime terrain modification
  • Save/Open of scene.lth files
  • Simplex noise height source
  • Wind and Erosion algorithms
  • Gaussian Filtering
  • Mixing and Adjusting
  • Mathemathical operators
  • Float array and DXF mesh export
  • PNG texture export

Requirements

Lithosphere requires a fast computer and graphics card to operate. It also requires specific opengl compatibility
  • OpenGL shading language version 1.20
  • GL_ARB_texture_float
  • GL_ARB_pixel_buffer_object
  • GL_ARB_vertex_buffer_object
  • GL_ARB_framebuffer_object

Recommended system specs

  • Intel Quad Core CPU
  • 2gb RAM
  • Nvidia Geforce GTX-285
  • 1gb video ram

Working with

  • Nvidia Geforce GTX-285
  • Nvidia Geforce 8800 GTS
  • Nvidia Quadro FX1700 512mb

miercuri, 12 iulie 2017

Godot game engine and python language.

As you know the Godot game engine is an advanced, feature-packed, multi-platform 2D and 3D open source game engine.
The author of this feature named Leblond Emmanuel come with this idea to have python language into Godot game engine.
This feature of Python into Godot game engine come with some advanced ways to solve the problem:
  •  using Micropython interpreter instead of CPython 
  •  using PyBind11 to statically bind to Godot C++ API 
  •  and using CFFI and rely on a 3rd party C API 
You can see the author's speech at the meeting EuroPython 2017:

duminică, 2 iulie 2017

The Visual Components software.

Is a complex software application with many tools for engineers  and not just for them.
The team development tells us:
There are four main applications for the Visual Components software: an engineering tool, a sales tool, a robot programming tool and a platform for building your own simulation solution.
The parts of this project come with this issues:
  • Layout Configuration 
  • CAD Compatibility 
  • Project Ready Deliverables 
  • Simple Robotics 
  • Component Modeling 
  • Advanced Robotics 
With Python API, which is available in all Visual Components 4.0 products we have a good platform for teaching, automating and post-processing robot programs.
For training , courses are collections of lessons you need to visit this link.
See the video from official youtube channel:
You can download this application from here.

luni, 21 mai 2012

Python , OpenGL and cube map OpenGL ARB

Today I will show a simple script that uses the OpenGL ARB "Architecture Review Board". The result is show in the next image.
I use just one image file named 111.JPG for all cube images. Let's see the python script.

from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
from OpenGL.GL.ARB.texture_cube_map import *
import Image                
import sys
#after I import all module , I set some vars
angle    = 0.1
texture  = 0
#this var set the type of reflection
reflMode = GL_REFLECTION_MAP_ARB
#this load the texture 
def loadTexture ( fileName ):
    image  = Image.open ( fileName )
    width  = image.size [0]
    height = image.size [1]
    image  = image.tostring ( "raw", "RGBX", 0, -1 )
    
    texture = glGenTextures ( 1 )
    glBindTexture     ( GL_TEXTURE_2D, texture )   
    glPixelStorei     ( GL_UNPACK_ALIGNMENT,1 )
    glTexParameterf   ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT )
    glTexParameterf   ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT )
    glTexParameteri   ( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR )
    glTexParameteri   ( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR )
    gluBuild2DMipmaps ( GL_TEXTURE_2D, 3, width, height, GL_RGBA, GL_UNSIGNED_BYTE, image )
    
    return texture
#this load a cube map of six images
def loadCubemap ( faces, path = ""  ):
    texture = glGenTextures ( 1 )
    target_map  = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
    glBindTexture     ( GL_TEXTURE_CUBE_MAP_ARB, texture )  
    glPixelStorei     ( GL_PACK_ALIGNMENT,1 )
    glTexParameteri   ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,     GL_REPEAT )
    glTexParameteri   ( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,     GL_REPEAT )
    glTexParameteri   ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR )
    glTexParameteri   ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR )
    glEnable          ( GL_TEXTURE_CUBE_MAP_ARB )
       
    for face in faces:
        if path != "":
            file = path + "/" + f
        else:
            file = face
        image  = Image.open ( file )
        width  = image.size [0]
        height = image.size [1]
        image  = image.tostring ( "raw", "RGBX", 0, -1 )
        gluBuild2DMipmaps ( target_map, 3, width, height, GL_RGBA, GL_UNSIGNED_BYTE, image )
        target_map = target_map + 1
    return texture
#this check if is working OpenGL ARB extension 
def extensionInit ():
    if not glInitTextureCubeMapARB ():
        print "ARB_texture_cubemap not working !"
        sys.exit ( 1 )
#this is default init of opengl 
def init ():
    glClearColor ( 1.0, 1.0, 1.0, 0.0 )
    glClearDepth ( 1.0 )                
    glDepthFunc  ( GL_LEQUAL )
    glEnable     ( GL_DEPTH_TEST )
    glHint       ( GL_POLYGON_SMOOTH_HINT,         GL_NICEST )
    glHint       ( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST )
#this help us when resize the window
def reshape ( width, height ):
    glViewport     ( 0, 0, width, height )
    glMatrixMode   ( GL_PROJECTION )
    glLoadIdentity ()
    gluPerspective ( 55.0, float(width)/float (height), 1.0, 60.0 )
    glMatrixMode   ( GL_MODELVIEW )
    glLoadIdentity ()
    gluLookAt      ( 0.0, 6.0, 0.0, 4.0, -4.0, 4.0, 0.0, 0.5, 0.0 )

def display ():
    global texture, reflMode
    
    glClear   ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT )
    glEnable  ( GL_TEXTURE_CUBE_MAP_ARB )
    glEnable  ( GL_TEXTURE_GEN_S )
    glEnable  ( GL_TEXTURE_GEN_T )
    glEnable  ( GL_TEXTURE_GEN_R )
    glTexGeni ( GL_S, GL_TEXTURE_GEN_MODE, reflMode )
    glTexGeni ( GL_T, GL_TEXTURE_GEN_MODE, reflMode )
    glTexGeni ( GL_R, GL_TEXTURE_GEN_MODE, reflMode )
    
    glBindTexture   ( GL_TEXTURE_CUBE_MAP_ARB, texture )
    glPushMatrix    ()
    glTranslatef    ( 2, 2, 2 )
    glRotatef       ( angle,  0, 10, 0 )
    
    glutSolidTeapot ( 1.5 )
    
    glPopMatrix     ()
    glutSwapBuffers ()
#this test the keyboard
def keyPressed ( *args ):
    global reflMode
    
    key = args [0]
    if key == '\033':
        sys.exit ()
    elif key == 'n' or key == 'N':
        reflMode = GL_NORMAL_MAP_ARB
    elif key == 'r' or key == 'R':
        reflMode = GL_REFLECTION_MAP_ARB
#this will animate , is a idle function
def animate ():
    global angle
    
    angle  = 0.01 * glutGet ( GLUT_ELAPSED_TIME )
   
    glutPostRedisplay ()
#... and the main function
def main ():
    global texture
    
    glutInit               ( sys.argv )
    glutInitDisplayMode    ( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH )
    glutInitWindowSize     ( 600, 400 )
    glutInitWindowPosition ( 0, 0 )
    
    glutCreateWindow ( "ARB_texture_cubemap demo" )
    glutDisplayFunc  ( display )
    glutIdleFunc     ( animate )
    glutReshapeFunc  ( reshape )
    glutKeyboardFunc ( keyPressed )

    init          ()
    extensionInit ();
    
    texture = loadCubemap ( ( "111.JPG", "111.JPG", "111.JPG", "111.JPG", "111.JPG", "111.JPG" ), "" )
    print texture
    glutMainLoop()

print "Hit ESC key to quit."
main()

vineri, 13 august 2010

OpenGL and Python - GLSL example

Today I played a bit with GLSL.
Here is the final result in the image below:

The source code used by me:

vertex shader
varying vec3 normal;
void main() {
  normal = gl_NormalMatrix * gl_Normal;
  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
 }
fragment shader
varying vec3 normal;
void main() {
 float scale = 1.0 / 10.0;
 float frx = fract(gl_FragCoord.x * scale);
 float fry = fract(gl_FragCoord.y * scale);
 gl_FragColor = vec4(frx,fry,0.0,1.0);
 }

marți, 16 martie 2010

OpenGL and Python - Motion blur

What is glAccum? The OpenGL function - glAccum operate on the accumulation buffer.
This function provides support for many special effects.
Today I simulated the effect of motion blur with this function.
See the picture below:

duminică, 14 martie 2010

OpenGL and Python - Fog

Today I spent my time with something new - the OpenGL fog effect.
I made one simple fog effect using the last code source.
The result is this image:

marți, 9 martie 2010

OpenGL and Python - Glut

The pyopengl python module showing now the true power of OpenGL.
The python code is simple and this allows us to see the OpenGL teapot object.
The image below, it's a screenshot with this source code.

That is one of my projects about pyopengl.
The python code I used it is simple and it has about 150 rows with some features.