Code:
#include <acknex.h>
#include <default.c>

//IF YOU ARE USING ONLY RECTANGULAR SHAPES IN THE IMAGE
//THIS SHOULD BE ENOUGH FOR A SIMPLE ALGORITHM

//PS.. i have removed line : ent_clone in dmdl_create_instance of dynamicmodels.c when i coded this example
//so i mention this if something odd happens on your pc wich is'nt happening on mine

//path to tust
#define PRAGMA_PATH "..\\tust"
#include "tust.h"

//just a texture
BMAP* myskin="skin.tga";

//your source bmap
BMAP* source="source.bmp";

void create_quadface(VECTOR* pos,VECTOR* size,DynamicModel* model)
{
	
	/*
		uv mapping coordinates
		----------------------
			   <-U->
		(0,0).........
			  .	    .
			V .       .
			  .       .
			  .........(1,1)
	
	*/
	
	//vertices
	VECTOR v[4];
	
	//upper left
	vec_set(v[0],vector(pos.x+size.x,pos.y+size.x,pos.z));
	
	//upper right
	vec_set(v[1],vector(pos.x+size.x,pos.y-size.x,pos.z));

	//lower left
	vec_set(v[2],vector(pos.x-size.x,pos.y+size.x,pos.z));

	//lower right
	vec_set(v[3],vector(pos.x-size.x,pos.y-size.x,pos.z));

	//left face of quad
	DYNAMIC_FACE face;
	//right face of quad
	DYNAMIC_FACE face1;
	memset(face,0,sizeof(DYNAMIC_FACE));
	memset(face1,0,sizeof(DYNAMIC_FACE));
	//left face
	int i;
	for(i=0;i<3;i++)
	{
		face.v[i].x=v[i].x;
		face.v[i].z=v[i].y;
		face.v[i].y=v[i].z;
	}
	
	//uv coordinates
	//upper left
		face.v[0].u1=0.0;
		face.v[0].v1=0.0;
	//upper right
		face.v[1].u1=1.0;
		face.v[1].v1=0.0;
	//lower left
		face.v[2].u1=0.0;
		face.v[2].v1=1.0;
	
	
	//right face
	int ii=1;
	for(i=0;i<3;i++)
	{
		if(i==0)ii=1;
		if(i==1)ii=3;
		if(i==2)ii=2;
		face1.v[i].x=v[ii].x;
		face1.v[i].z=v[ii].y;
		face1.v[i].y=v[ii].z;
	}

	//uv coordinates
	//upper right
		face1.v[0].u1=1.0;
		face1.v[0].v1=0.0;
	//lower right
		face1.v[1].u1=1.0;
		face1.v[1].v1=1.0;
	//lower left
		face1.v[2].u1=0.0;
		face1.v[2].v1=1.0;
		
	dmdl_add_face(model,&face);
	dmdl_add_face(model,&face1);
	//sys_free(face);
	//sys_free(face1);
	
}

ENTITY* from_bmp()
{
	DynamicModel *model =dmdl_create();
	int tile_size=16;

	int x=0;
	int y=0;
	int area=bmap_width(source)*bmap_height(source);

	var format = bmap_lock(source,0);

	for( ;x<area;x++)
	{
		if(x==bmap_width(source))
		{
			x=0;
			y+=1;
		}
		if(y==bmap_height(source))break;
		
		COLOR pix_color;
		var pix_alpha;
		var pixel=pixel_for_bmap(source,x,y);
		
		pixel_to_vec(pix_color,pix_alpha,format,pixel);
		
		//if you are using alpha channels to determine empty space
		//skip these pixels
		//if(pix_alpha<1) continue;
		
		//or if you are using colors to determine empty space
		//this bmap i used ,used white color as an empty space
		//skip these pixels
		if(pix_color.red==255 && pix_color.green==255 && pix_color.blue=255) continue;
		
		//add a quad in place of pixel
		//you would have to map the x and y to a position + an offset (not done),or transform vertices when done to center around a position
		
		//you have to check first if there is enough vertices/triangles space left before adding a new quad
		//since a quad has two triangles and 4 vertices before welding or whatever ,you may determine that easy
		//the total amount of SOLID pixels WILL effect how many quads there are ,since i am mapping every single pixel to a quad here
		create_quadface(vector(x*tile_size*2,y*tile_size*2,0),vector(tile_size,tile_size,0),model);
	}

	bmap_unlock(source);
	
	DMDLSettings.flags|=DMDL_FIXNORMALS;
	DMDLSettings.flags|=DMDL_OPTIMIZE;
	ENTITY* ent=dmdl_create_instance(model,nullvector,NULL);
	
 	sys_free(model);
 	
 	return ent;
}

function main()
{
	vec_set(screen_size,vector(800,600,0));
	vec_set(screen_color,vector(1,1,1));
	vec_set(sky_color,vector(1,1,1));
	video_window(NULL,NULL,0,"experimental test, map a pixel to a quad face");
	d3d_antialias = 1;
	
	level_load("");
	def_debug();def_debug();def_move();
  	wait(1);
  	
  	ENTITY* ent=from_bmp();
	ent_setskin(ent,myskin,1);
	
	while(1)
	{
		draw_point3d(nullvector,COLOR_RED,100,1);
		wait(1);
	}
	
}



are you not after per pixel collision ?


Compulsive compiler